Commit ce374384 authored by Jeremy C. Reed's avatar Jeremy C. Reed
Browse files

[jreed-doxygen]Merge branch 'master' into jreed-doxygen

Handled conflict.
Also removed spaces on a blank line.
parents ba9ed9d6 0ec520e6
200. [bug] Jelte
Fixed a bug where incoming TCP connections were not closed.
(Trac #589, git 1d88daaa24e8b1ab27f28be876f40a144241e93b)
199. [func] ocean 199. [func] ocean
Cache negative responses (NXDOMAIN/NODATA) from authoritative Cache negative responses (NXDOMAIN/NODATA) from authoritative
server for recursive resolver. server for recursive resolver.
......
...@@ -63,7 +63,8 @@ public: ...@@ -63,7 +63,8 @@ public:
/// ///
/// \param io_message The event message to handle /// \param io_message The event message to handle
/// \param message The DNS MessagePtr that needs handling /// \param message The DNS MessagePtr that needs handling
/// \param answer_message The DNS MessagePtr TODO /// \param answer_message The final answer will be constructed in
/// this MessagePtr
/// \param buffer The final answer is put here /// \param buffer The final answer is put here
/// \param server DNSServer object to use /// \param server DNSServer object to use
virtual void operator()(const IOMessage& io_message, virtual void operator()(const IOMessage& io_message,
......
...@@ -115,6 +115,7 @@ TCPServer::operator()(error_code ec, size_t length) { ...@@ -115,6 +115,7 @@ TCPServer::operator()(error_code ec, size_t length) {
CORO_YIELD async_read(*socket_, asio::buffer(data_.get(), CORO_YIELD async_read(*socket_, asio::buffer(data_.get(),
TCP_MESSAGE_LENGTHSIZE), *this); TCP_MESSAGE_LENGTHSIZE), *this);
if (ec) { if (ec) {
socket_->close();
CORO_YIELD return; CORO_YIELD return;
} }
...@@ -127,6 +128,7 @@ TCPServer::operator()(error_code ec, size_t length) { ...@@ -127,6 +128,7 @@ TCPServer::operator()(error_code ec, size_t length) {
} }
if (ec) { if (ec) {
socket_->close();
CORO_YIELD return; CORO_YIELD return;
} }
...@@ -160,6 +162,7 @@ TCPServer::operator()(error_code ec, size_t length) { ...@@ -160,6 +162,7 @@ TCPServer::operator()(error_code ec, size_t length) {
// If we don't have a DNS Lookup provider, there's no point in // If we don't have a DNS Lookup provider, there's no point in
// continuing; we exit the coroutine permanently. // continuing; we exit the coroutine permanently.
if (lookup_callback_ == NULL) { if (lookup_callback_ == NULL) {
socket_->close();
CORO_YIELD return; CORO_YIELD return;
} }
...@@ -177,6 +180,9 @@ TCPServer::operator()(error_code ec, size_t length) { ...@@ -177,6 +180,9 @@ TCPServer::operator()(error_code ec, size_t length) {
// The 'done_' flag indicates whether we have an answer // The 'done_' flag indicates whether we have an answer
// to send back. If not, exit the coroutine permanently. // to send back. If not, exit the coroutine permanently.
if (!done_) { if (!done_) {
// TODO: should we keep the connection open for a short time
// to see if new requests come in?
socket_->close();
CORO_YIELD return; CORO_YIELD return;
} }
...@@ -195,6 +201,10 @@ TCPServer::operator()(error_code ec, size_t length) { ...@@ -195,6 +201,10 @@ TCPServer::operator()(error_code ec, size_t length) {
// (though we have nothing further to do, so the coroutine // (though we have nothing further to do, so the coroutine
// will simply exit at that time). // will simply exit at that time).
CORO_YIELD async_write(*socket_, bufs, *this); CORO_YIELD async_write(*socket_, bufs, *this);
// TODO: should we keep the connection open for a short time
// to see if new requests come in?
socket_->close();
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment