BIND 10 trac357, updated. 5119bf75e932910f872098a65ec76063c142f5c2 [357] set default tcp recv timeout to 5 seconds

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Aug 31 13:35:58 UTC 2012


The branch, trac357 has been updated
       via  5119bf75e932910f872098a65ec76063c142f5c2 (commit)
       via  c1f4e353392c6dfaa23370010972ce97354e12c3 (commit)
       via  6c9732dc5b937177c1989fffe12970d5f08fb8f0 (commit)
      from  5298a0caf701c0d3a567679d1519de1f9fdb9a4a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5119bf75e932910f872098a65ec76063c142f5c2
Author: Jelte Jansen <jelte at isc.org>
Date:   Fri Aug 31 15:35:36 2012 +0200

    [357] set default tcp recv timeout to 5 seconds

commit c1f4e353392c6dfaa23370010972ce97354e12c3
Author: Jelte Jansen <jelte at isc.org>
Date:   Fri Aug 31 14:26:56 2012 +0200

    [357] test for negative timeout config

commit 6c9732dc5b937177c1989fffe12970d5f08fb8f0
Author: Jelte Jansen <jelte at isc.org>
Date:   Fri Aug 31 13:58:02 2012 +0200

    [357] address review comments
    
    - explain 0 value for tcp_recv_timeout
    - initialize value in config parser (to 0, it will be set by build() anyway)

-----------------------------------------------------------------------

Summary of changes:
 doc/guide/bind10-guide.xml            |    1 +
 src/bin/auth/auth.spec.pre.in         |    2 +-
 src/bin/auth/auth_config.cc           |    8 ++++++--
 src/bin/auth/b10-auth.xml             |    1 +
 src/bin/auth/tests/config_unittest.cc |    3 +++
 src/lib/asiodns/dns_service.cc        |    2 +-
 src/lib/asiodns/tcp_server.cc         |    2 +-
 7 files changed, 14 insertions(+), 5 deletions(-)

-----------------------------------------------------------------------
diff --git a/doc/guide/bind10-guide.xml b/doc/guide/bind10-guide.xml
index 61cddd6..cbdad93 100644
--- a/doc/guide/bind10-guide.xml
+++ b/doc/guide/bind10-guide.xml
@@ -1640,6 +1640,7 @@ can use various data source backends.
                 <varname>tcp_recv_timeout</varname> is the timeout used on
                 incoming TCP connections, in milliseconds. If the query
                 is not sent within this time, the connection is closed.
+                Setting this to 0 will disable TCP timeouts completely.
               </simpara>
             </listitem>
           </varlistentry>
diff --git a/src/bin/auth/auth.spec.pre.in b/src/bin/auth/auth.spec.pre.in
index 3c31c2d..a471b7a 100644
--- a/src/bin/auth/auth.spec.pre.in
+++ b/src/bin/auth/auth.spec.pre.in
@@ -94,7 +94,7 @@
       { "item_name": "tcp_recv_timeout",
         "item_type": "integer",
         "item_optional": false,
-        "item_default": 1000
+        "item_default": 5000
       }
     ],
     "commands": [
diff --git a/src/bin/auth/auth_config.cc b/src/bin/auth/auth_config.cc
index 6cc356e..e8592ac 100644
--- a/src/bin/auth/auth_config.cc
+++ b/src/bin/auth/auth_config.cc
@@ -120,11 +120,15 @@ private:
 /// \brief Configuration for TCP receive timeouts
 class TCPRecvTimeoutConfig : public AuthConfigParser {
 public:
-    TCPRecvTimeoutConfig(AuthSrv& server) : server_(server)
+    TCPRecvTimeoutConfig(AuthSrv& server) : server_(server), timeout_(0)
     {}
 
     virtual void build(ConstElementPtr config) {
-        timeout_ = config->intValue();
+        if (config->intValue() >= 0) {
+            timeout_ = config->intValue();
+        } else {
+            isc_throw(AuthConfigError, "tcp_recv_timeout must be 0 or higher");
+        }
     }
 
     virtual void commit() {
diff --git a/src/bin/auth/b10-auth.xml b/src/bin/auth/b10-auth.xml
index 556873c..b34009d 100644
--- a/src/bin/auth/b10-auth.xml
+++ b/src/bin/auth/b10-auth.xml
@@ -156,6 +156,7 @@
       <varname>tcp_recv_timeout</varname> is the timeout used on
       incoming TCP connections, in milliseconds. If the query
       is not sent within this time, the connection is closed.
+      Setting this to 0 will disable TCP timeouts completely.
     </para>
 
 <!-- TODO: formating -->
diff --git a/src/bin/auth/tests/config_unittest.cc b/src/bin/auth/tests/config_unittest.cc
index 84f86b4..830de0d 100644
--- a/src/bin/auth/tests/config_unittest.cc
+++ b/src/bin/auth/tests/config_unittest.cc
@@ -151,6 +151,9 @@ TEST_F(AuthConfigTest, tcpRecvTimeoutConfig) {
     configureAuthServer(server, Element::fromJSON(
     "{ \"tcp_recv_timeout\": 2000 }"));
     EXPECT_EQ(2000, dnss_.getTCPRecvTimeout());
+    EXPECT_THROW(configureAuthServer(server, Element::fromJSON(
+                    "{ \"tcp_recv_timeout\": -123 }")),
+                 AuthConfigError);
 }
 
 }
diff --git a/src/lib/asiodns/dns_service.cc b/src/lib/asiodns/dns_service.cc
index 03ec09d..f72d24b 100644
--- a/src/lib/asiodns/dns_service.cc
+++ b/src/lib/asiodns/dns_service.cc
@@ -40,7 +40,7 @@ public:
     DNSServiceImpl(IOService& io_service, SimpleCallback* checkin,
                    DNSLookup* lookup, DNSAnswer* answer) :
             io_service_(io_service), checkin_(checkin), lookup_(lookup),
-            answer_(answer), tcp_recv_timeout_(1000)
+            answer_(answer), tcp_recv_timeout_(5000)
     {}
 
     IOService& io_service_;
diff --git a/src/lib/asiodns/tcp_server.cc b/src/lib/asiodns/tcp_server.cc
index c291b6f..ed3f28c 100644
--- a/src/lib/asiodns/tcp_server.cc
+++ b/src/lib/asiodns/tcp_server.cc
@@ -72,7 +72,7 @@ TCPServer::TCPServer(io_service& io_service, int fd, int af,
     }
     // Set it to some value. It should be set to the right one
     // immediately, but set it to something non-zero just in case.
-    tcp_recv_timeout_.reset(new size_t(1000));
+    tcp_recv_timeout_.reset(new size_t(5000));
 }
 
 namespace {



More information about the bind10-changes mailing list