[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Oct 15 15:20:09 CDT 2010


branch "master" has been updated
       via  3f572c52e621b77b1576980a5e5cc26acdb08068 (commit)
      from  b673f61c24b9af1bed347414a9b772aaf5dfe490 (commit)

Summary of changes:
 logger                |    2 +-
 slice                 |    2 +-
 src/BridgeImpl.cpp    |   83 +++++++++++++++++++++++++------------------------
 src/ListenerManager.h |   17 ++++++++++
 4 files changed, 61 insertions(+), 43 deletions(-)


- Log -----------------------------------------------------------------
commit 3f572c52e621b77b1576980a5e5cc26acdb08068
Author: Brent Eagles <beagles at digium.com>
Date:   Fri Oct 15 17:49:16 2010 -0230

    Fix up some bridge shutdown/cleanup issues.

diff --git a/logger b/logger
index a867306..e376034 160000
--- a/logger
+++ b/logger
@@ -1 +1 @@
-Subproject commit a867306cbc5dce5b0cd899094b3215921f0263d3
+Subproject commit e376034d1791e30821dc5f37bd64fd155643d478
diff --git a/slice b/slice
index bdfc399..71b02b7 160000
--- a/slice
+++ b/slice
@@ -1 +1 @@
-Subproject commit bdfc399d5876152d46be8b47cd4122abca1d2ed3
+Subproject commit 71b02b7071eab51d417f059566dc4aef1ebc2f2f
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 7d04028..dafc7ea 100644
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -386,21 +386,11 @@ AsteriskSCF::BridgeService::BridgeImpl::BridgeImpl(
 
 AsteriskSCF::BridgeService::BridgeImpl::~BridgeImpl()
 {
-    try
-    {
-        //
-        // We don't want to remove all listener activity unless we are definitively destroyed. Any other
-        // situations where the bridge servant might be released from memory might be a temporary condition
-        // where we may want events to hold until some kind of timeout causes the listener to be removed.
-        //
-        if(mState == Destroyed && mSessionListenerPrx != 0)
-        {
-            mObjAdapter->remove(mSessionListenerPrx->ice_getIdentity());
-        }
-    }
-    catch(...)
-    {
-    }
+    //
+    // TODO: Determine if we need to clean up the listener manager. We may not
+    // want to in the case of replicated bridges. ie. we might want to only
+    // tear down the topic if the bridge is destroyed/shutdown.
+    //
 }
 
 void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
@@ -550,6 +540,43 @@ void AsteriskSCF::BridgeService::BridgeImpl::shutdown(const Ice::Current& curren
     lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": is shutdown." ;
     mListeners->stopped();
     mState = Destroyed;
+
+    //
+    // Remove references to the session listener implementation.
+    //
+    mObjAdapter->remove(mSessionListenerPrx->ice_getIdentity());
+    mSessionListener = 0;
+}
+
+void AsteriskSCF::BridgeService::BridgeImpl::destroy(const Ice::Current& current)
+{
+    {
+        lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
+        boost::unique_lock<boost::shared_mutex> lock(mLock);
+        if(mState == ShuttingDown)
+        {
+            lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
+            throw AsteriskSCF::System::Component::V1::ShuttingDown();
+        }
+        if(mState == Destroyed)
+        {
+            lg(Debug) << __FUNCTION__ << ": called when destroyed." ;
+            throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+        }
+        mState = Destroyed;
+        lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": is now destroyed." ;
+        mListeners->stopped();
+        mSessionListener = 0;
+
+        //
+        // Remove references to the session listener implementation.
+        //
+        mObjAdapter->remove(mSessionListenerPrx->ice_getIdentity());
+    }
+
+    //
+    // The bridge manager removes us from the object adapter on reaping. 
+    //
 }
 
 void AsteriskSCF::BridgeService::BridgeImpl::addListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
@@ -662,32 +689,6 @@ void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::S
     }
 }
 
-void AsteriskSCF::BridgeService::BridgeImpl::destroy(const Ice::Current& current)
-{
-    {
-        lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
-        boost::unique_lock<boost::shared_mutex> lock(mLock);
-        if(mState == ShuttingDown)
-        {
-            lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
-            throw AsteriskSCF::System::Component::V1::ShuttingDown();
-        }
-        if(mState == Destroyed)
-        {
-            lg(Debug) << __FUNCTION__ << ": called when destroyed." ;
-            throw Ice::ObjectNotExistException(__FILE__, __LINE__);
-        }
-        mState = Destroyed;
-        lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": is now destroyed." ;
-        mListeners->stopped();
-    }
-    
-    //
-    // Last act is to remove the servant from the map.
-    //
-    mObjAdapter->remove(current.id);
-}
-
 bool AsteriskSCF::BridgeService::BridgeImpl::destroyed()
 {
     boost::shared_lock<boost::shared_mutex> lock(mLock);
diff --git a/src/ListenerManager.h b/src/ListenerManager.h
index 7f0e069..170e9cb 100644
--- a/src/ListenerManager.h
+++ b/src/ListenerManager.h
@@ -86,6 +86,23 @@ namespace BridgeService
             }
         }
 
+        virtual ~ListenerManagerT()
+        {
+            if(mTopic)
+            {
+                try
+                {
+                    mTopic->destroy();
+                }
+                catch(...)
+                {
+                    //
+                    // Destructors are no-throw!
+                    //
+                }
+            }
+        }
+
         //
         // NOTE: The current implementation is a little fast and loose here. Inconsistent conditions
         // and whatnot are not flagged.

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/bridging.git



More information about the asterisk-scf-commits mailing list