[svn] commit: r3438 - /experiments/kambe-auth-stats/src/bin/auth/asio_link.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Nov 4 08:18:12 UTC 2010


Author: naokikambe
Date: Thu Nov  4 08:18:11 2010
New Revision: 3438

Log:
- add checking the value of 'auth_server_' variable, whether NULL or not
- change initializing 'dltimer_' variable according to other variables

Modified:
    experiments/kambe-auth-stats/src/bin/auth/asio_link.cc

Modified: experiments/kambe-auth-stats/src/bin/auth/asio_link.cc
==============================================================================
--- experiments/kambe-auth-stats/src/bin/auth/asio_link.cc (original)
+++ experiments/kambe-auth-stats/src/bin/auth/asio_link.cc Thu Nov  4 08:18:11 2010
@@ -570,7 +570,8 @@
                              const ip::address* const v6addr) :
     auth_server_(auth_server),
     udp4_server_(UDPServerPtr()), udp6_server_(UDPServerPtr()),
-    tcp4_server_(TCPServerPtr()), tcp6_server_(TCPServerPtr())
+    tcp4_server_(TCPServerPtr()), tcp6_server_(TCPServerPtr()),
+    dltimer_(DlTimerPtr())
 {
     uint16_t portnum;
 
@@ -602,12 +603,14 @@
             tcp6_server_ = TCPServerPtr(new TCPServer(auth_server, io_service_,
                                                       *v6addr, portnum));
         }
-        // start deadline_timer
-        dltimer_.reset(new asio::deadline_timer(io_service_));
-        dltimer_->expires_from_now(boost::posix_time::seconds(
-                                       auth_server_->getTimeoutSec()));
-        dltimer_->async_wait(boost::bind(&IOServiceImpl::AsWaitHandler,
-                                         this, asio::placeholders::error));
+        if (auth_server_ != NULL) {
+            // start deadline_timer
+            dltimer_ = DlTimerPtr(new asio::deadline_timer(io_service_));
+            dltimer_->expires_from_now(boost::posix_time::seconds(
+                                           auth_server_->getTimeoutSec()));
+            dltimer_->async_wait(boost::bind(&IOServiceImpl::AsWaitHandler,
+                                             this, asio::placeholders::error));
+        }
     } catch (const asio::system_error& err) {
         // We need to catch and convert any ASIO level exceptions.
         // This can happen for unavailable address, binding a privilege port
@@ -629,7 +632,7 @@
              << endl;
         return;
     }
-    if (!auth_server_->sendtoStats())
+    if (auth_server_ == NULL || !(auth_server_->sendtoStats()))
         return;
     dltimer_->cancel(); // cancel the last operation if not done.
     dltimer_->expires_at(dltimer_->expires_at()




More information about the bind10-changes mailing list