From: JINMEI Tatuya Date: Wed, 11 Jan 2012 07:34:36 +0000 (-0800) Subject: [1546] delay listening to config/command from the module cc session X-Git-Tag: trac2351_base~296^2^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=be7b75528c3bd4ae882136cdac6ecf925ac9f621;p=thirdparty%2Fkea.git [1546] delay listening to config/command from the module cc session until the initial configuration is completed. otherwise it confuses communication with the socket creator and makes listen_on fail. --- diff --git a/src/bin/resolver/main.cc b/src/bin/resolver/main.cc index ef995c2b24..de47db77b0 100644 --- a/src/bin/resolver/main.cc +++ b/src/bin/resolver/main.cc @@ -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) {