]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1546] delay listening to config/command from the module cc session
authorJINMEI Tatuya <jinmei@isc.org>
Wed, 11 Jan 2012 07:34:36 +0000 (23:34 -0800)
committerJINMEI Tatuya <jinmei@isc.org>
Wed, 11 Jan 2012 07:34:36 +0000 (23:34 -0800)
until the initial configuration is completed.  otherwise it confuses
communication with the socket creator and makes listen_on fail.

src/bin/resolver/main.cc

index ef995c2b24349672809b4bfdf1d2830fd9ff9eab..de47db77b041a585e1c4cf7d3130c8dbe3e3d262 100644 (file)
@@ -209,9 +209,16 @@ main(int argc, char* argv[]) {
 
         cc_session = new Session(io_service.get_io_service());
         isc::server_common::initSocketReqeustor(*cc_session);
+
+        // We delay starting listening to new commands/config just before we
+        // go into the main loop to avoid confusion due to mixture of
+        // synchronous and asynchronous operations (this would happen in
+        // initial communication with the socket creator that takes place in
+        // updateConfig()).  Until then all operations on the CC session will
+        // take place synchronously.
         config_session = new ModuleCCSession(specfile, *cc_session,
                                              my_config_handler,
-                                             my_command_handler);
+                                             my_command_handler, false);
         LOG_DEBUG(resolver_logger, RESOLVER_DBG_INIT, RESOLVER_CONFIG_CHANNEL);
 
         // FIXME: This does not belong here, but inside Boss
@@ -229,6 +236,9 @@ main(int argc, char* argv[]) {
         resolver->updateConfig(config_session->getFullConfig(), true);
         LOG_DEBUG(resolver_logger, RESOLVER_DBG_INIT, RESOLVER_CONFIG_LOADED);
 
+        // Now start asynchronous read.
+        config_session->start();
+
         LOG_INFO(resolver_logger, RESOLVER_STARTED);
         io_service.run();
     } catch (const std::exception& ex) {