Fixed crash during shutdown by putting RPC handle pool on the heap.
authorScott Cantor <cantor.2@osu.edu>
Mon, 10 Jan 2005 18:58:13 +0000 (18:58 +0000)
committerScott Cantor <cantor.2@osu.edu>
Mon, 10 Jan 2005 18:58:13 +0000 (18:58 +0000)
shib-target/internal.h
shib-target/shib-config.cpp

index 9b33bc7..1eee2c1 100644 (file)
@@ -164,17 +164,17 @@ namespace shibtarget {
     class STConfig : public ShibTargetConfig
     {
     public:
-        STConfig() : m_tranLog(NULL), m_tranLogLock(NULL) {}
+        STConfig() : m_tranLog(NULL), m_tranLogLock(NULL), m_rpcpool(NULL) {}
         ~STConfig() {}
         
         bool init(const char* schemadir, const char* config);
         void shutdown();
         
-        RPCHandlePool& getRPCHandlePool() {return m_rpcpool;}
+        RPCHandlePool& getRPCHandlePool() {return *m_rpcpool;}
         log4cpp::Category& getTransactionLog() { m_tranLogLock->lock(); return *m_tranLog; }
         void releaseTransactionLog() { m_tranLogLock->unlock();}
     private:
-        RPCHandlePool m_rpcpool;
+        RPCHandlePool* m_rpcpool;
         log4cpp::FixedContextCategory* m_tranLog;
         shibboleth::Mutex* m_tranLogLock;
         static IConfig* ShibTargetConfigFactory(const DOMElement* e);
index 54e51a7..c00923f 100644 (file)
@@ -186,10 +186,13 @@ bool STConfig::init(const char* schemadir, const char* config)
         m_tranLog=new FixedContextCategory(SHIBTRAN_LOGCAT);
         m_tranLog->info("opened transaction log");
         m_tranLogLock = Mutex::create();
+
+        m_rpcpool = new RPCHandlePool;
     }
     catch (...) {
         log.fatal("caught exception while loading/initializing configuration");
         delete m_ini;
+        delete m_rpcpool;
         shibConf.term();
         samlConf.term();
         return false;
@@ -205,6 +208,8 @@ void STConfig::shutdown()
     saml::NDC ndc("shutdown");
     Category& log = Category::getInstance("shibtarget.STConfig");
     log.info("shutting down the library");
+    delete m_rpcpool;
+    m_rpcpool = NULL;
     delete m_tranLogLock;
     m_tranLogLock = NULL;
     //delete m_tranLog; // This is crashing for some reason, but we're shutting down anyway.