]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2934] (unrelated fix) make sure closing auth TCP socket after first AXFR.
authorJINMEI Tatuya <jinmei@isc.org>
Thu, 16 May 2013 22:48:50 +0000 (15:48 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Thu, 16 May 2013 22:55:17 +0000 (15:55 -0700)
this only happens for very first TCP connection that does not result in
an answer, so wouldn't be very problematic in practice.  but it's still
awkward.

src/lib/asiodns/asiodns_messages.mes
src/lib/asiodns/tcp_server.cc

index 5f2a2642234bcf365fe1673fc04f5ece10ed2456..71aded784099f69c97a392b44f11aac36939993b 100644 (file)
@@ -103,6 +103,12 @@ would be better to not be too verbose, but you might want to increase
 the log level and make sure there's no resource leak or other system
 level troubles when it's logged.
 
+% ASIODNS_TCP_CLOSE_NORESP_FAIL failed to close DNS/TCP socket with a client: %1
+A TCP DNS server tried to close a TCP socket used to communicate with
+a client without returning an answer (which normally happens for zone
+transfer requests), but it failed to do that.  See ASIODNS_TCP_CLOSE_FAIL
+for more details.
+
 % ASIODNS_TCP_GETREMOTE_FAIL failed to get remote address of a DNS TCP connection: %1
 A TCP DNS server tried to get the address and port of a remote client
 on a connected socket but failed.  It's expected to be rare but can
index 32a43ce65d4ec600d70d836edee3a922baf4204d..cb77e3ddac70d60b1e33d9fa93fef92d51670e3d 100644 (file)
@@ -235,8 +235,15 @@ TCPServer::operator()(asio::error_code ec, size_t length) {
         // The 'done_' flag indicates whether we have an answer
         // to send back.  If not, exit the coroutine permanently.
         if (!done_) {
+            // Explicitly close() isn't necessary for most cases. But for the
+            // very connection, socket_ is shared with the original owner of
+            // the server object and would stay open.
             // TODO: should we keep the connection open for a short time
             // to see if new requests come in?
+            socket_->close(ec);
+            if (ec) {
+                LOG_DEBUG(logger, 0, ASIODNS_TCP_CLOSE_FAIL).arg(ec.message());
+            }
             return;
         }