diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/CommunicatorI.h | 5 | ||||
-rw-r--r-- | cpp/src/Ice/Initialize.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 91 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.h | 2 |
5 files changed, 53 insertions, 53 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 27dfcb5906c..644d09031a0 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -270,7 +270,7 @@ Ice::CommunicatorI::~CommunicatorI() } void -Ice::CommunicatorI::loadPlugins(int& argc, char* argv[]) +Ice::CommunicatorI::finishSetup(int& argc, char* argv[]) { - _instance->loadPlugins(argc, argv); + _instance->finishSetup(argc, argv); } diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h index df7b2a2a2ea..d0f0e7f10ab 100644 --- a/cpp/src/Ice/CommunicatorI.h +++ b/cpp/src/Ice/CommunicatorI.h @@ -58,9 +58,10 @@ private: virtual ~CommunicatorI(); // - // Load plug-ins after the constructor has completed. + // Certain initialization tasks need to be completed after the + // constructor. // - void loadPlugins(int&, char*[]); + void finishSetup(int&, char*[]); friend ICE_API CommunicatorPtr initialize(int&, char*[], Int); friend ICE_API CommunicatorPtr initializeWithProperties(int&, char*[], const PropertiesPtr&, Int); diff --git a/cpp/src/Ice/Initialize.cpp b/cpp/src/Ice/Initialize.cpp index fead3c66b07..6bff3fa51ec 100644 --- a/cpp/src/Ice/Initialize.cpp +++ b/cpp/src/Ice/Initialize.cpp @@ -30,7 +30,7 @@ Ice::initialize(int& argc, char* argv[], Int version) PropertiesPtr defaultProperties = getDefaultProperties(argc, argv); CommunicatorI* communicatorI = new CommunicatorI(argc, argv, defaultProperties); CommunicatorPtr result = communicatorI; // For exception safety. - communicatorI->loadPlugins(argc, argv); + communicatorI->finishSetup(argc, argv); return result; } @@ -46,7 +46,7 @@ Ice::initializeWithProperties(int& argc, char* argv[], const PropertiesPtr& prop CommunicatorI* communicatorI = new CommunicatorI(argc, argv, properties); CommunicatorPtr result = communicatorI; // For exception safety. - communicatorI->loadPlugins(argc, argv); + communicatorI->finishSetup(argc, argv); return result; } diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index bacf75e1125..b1eb56349f4 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -348,51 +348,6 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, int& argc, _objectAdapterFactory = new ObjectAdapterFactory(this); -#ifndef _WIN32 - // - // daemon() is called before the plug-ins are loaded. - // If a plug-in needs to use a resource such as stdin - // (e.g., the SSL plug-in might want to read a passphrase), - // then Ice.DaemonNoClose must be specified. - // - if (_properties->getPropertyAsInt("Ice.Daemon") > 0) - { - int noclose = _properties->getPropertyAsInt("Ice.DaemonNoClose"); - int nochdir = _properties->getPropertyAsInt("Ice.DaemonNoChdir"); - - if (daemon(nochdir, noclose) == -1) - { - SystemException ex(__FILE__, __LINE__); - ex.error = getSystemErrno(); - throw ex; - } - } -#endif - - // - // Must be done after daemon() is called, since daemon() - // forks. Does not work together with Ice.Daemon if - // Ice.DaemonNoClose is not set. - // - if (_properties->getPropertyAsInt("Ice.PrintProcessId") > 0) - { -#ifdef _WIN32 - cout << _getpid() << endl; -#else - cout << getpid() << endl; -#endif - } - - // - // Thread pool initializations must be done after daemon() is - // called, since daemon() forks. - // - - // - // Thread pool initialization is now lazy initialization in - // clientThreadPool() and serverThreadPool(). - // - __setNoDelete(false); } catch(...) @@ -455,7 +410,7 @@ IceInternal::Instance::~Instance() } void -IceInternal::Instance::loadPlugins(int& argc, char* argv[]) +IceInternal::Instance::finishSetup(int& argc, char* argv[]) { // // Load plug-ins. @@ -463,6 +418,50 @@ IceInternal::Instance::loadPlugins(int& argc, char* argv[]) PluginManagerI* pluginManagerImpl = dynamic_cast<PluginManagerI*>(_pluginManager.get()); assert(pluginManagerImpl); pluginManagerImpl->loadPlugins(argc, argv); + +#ifndef _WIN32 + // + // daemon() must be called after any plug-ins have been + // installed. For example, an SSL plug-in might want to + // read a passphrase from standard input. + // + if (_properties->getPropertyAsInt("Ice.Daemon") > 0) + { + int noclose = _properties->getPropertyAsInt("Ice.DaemonNoClose"); + int nochdir = _properties->getPropertyAsInt("Ice.DaemonNoChdir"); + + if (daemon(nochdir, noclose) == -1) + { + SystemException ex(__FILE__, __LINE__); + ex.error = getSystemErrno(); + throw ex; + } + } +#endif + + // + // Must be done after daemon() is called, since daemon() + // forks. Does not work together with Ice.Daemon if + // Ice.DaemonNoClose is not set. + // + if (_properties->getPropertyAsInt("Ice.PrintProcessId") > 0) + { +#ifdef _WIN32 + cout << _getpid() << endl; +#else + cout << getpid() << endl; +#endif + } + + // + // Thread pool initializations must be done after daemon() is + // called, since daemon() forks. + // + + // + // Thread pool initialization is now lazy initialization in + // clientThreadPool() and serverThreadPool(). + // } void diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h index 63ea54e66fa..5e1b105dd35 100644 --- a/cpp/src/Ice/Instance.h +++ b/cpp/src/Ice/Instance.h @@ -68,7 +68,7 @@ private: Instance(const ::Ice::CommunicatorPtr&, int&, char*[], const ::Ice::PropertiesPtr&); virtual ~Instance(); - void loadPlugins(int&, char*[]); + void finishSetup(int&, char*[]); void destroy(); friend class ::Ice::CommunicatorI; |