[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 14:24:21 CDT 2010


branch "master" has been updated
       via  b673f61c24b9af1bed347414a9b772aaf5dfe490 (commit)
      from  439bfde4a09feed71b1af026b397ca126452fed6 (commit)

Summary of changes:
 src/BridgeImpl.cpp        |   15 ++++++++++++++-
 src/BridgeImpl.h          |    1 +
 src/BridgeManagerImpl.cpp |    8 ++++++--
 3 files changed, 21 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit b673f61c24b9af1bed347414a9b772aaf5dfe490
Author: Brent Eagles <beagles at digium.com>
Date:   Fri Oct 15 16:52:42 2010 -0230

    Fix and object leak where the bridge servant wasn't being removed from
    the object adapter after shutdown. It's now cleaned up during the
    reaping process.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 5a52fe8..7d04028 100644
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -393,7 +393,7 @@ AsteriskSCF::BridgeService::BridgeImpl::~BridgeImpl()
         // 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)
+        if(mState == Destroyed && mSessionListenerPrx != 0)
         {
             mObjAdapter->remove(mSessionListenerPrx->ice_getIdentity());
         }
@@ -549,6 +549,7 @@ void AsteriskSCF::BridgeService::BridgeImpl::shutdown(const Ice::Current& curren
 
     lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": is shutdown." ;
     mListeners->stopped();
+    mState = Destroyed;
 }
 
 void AsteriskSCF::BridgeService::BridgeImpl::addListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
@@ -694,6 +695,18 @@ bool AsteriskSCF::BridgeService::BridgeImpl::destroyed()
     return mState == Destroyed;
 }
 
+void AsteriskSCF::BridgeService::BridgeImpl::destroyImpl()
+{
+    boost::shared_lock<boost::shared_mutex> lock(mLock);
+    try
+    {
+        mObjAdapter->remove(mPrx->ice_getIdentity());
+    }
+    catch(const Ice::Exception&)
+    {
+    }
+}
+
 void AsteriskSCF::BridgeService::BridgeImpl::sessionConnected(const AsteriskSCF::SessionCommunications::V1::SessionPrx& session)
 {
     lg(Debug) << __FUNCTION__ << ": session connected " << session->ice_toString() ;
diff --git a/src/BridgeImpl.h b/src/BridgeImpl.h
index 5ddd410..77a98cf 100644
--- a/src/BridgeImpl.h
+++ b/src/BridgeImpl.h
@@ -121,6 +121,7 @@ namespace BridgeService
         // Internal methods
         //
         bool destroyed();
+        void destroyImpl();
 
         void sessionConnected(const AsteriskSCF::SessionCommunications::V1::SessionPrx& session);
         size_t sessionStopped(const AsteriskSCF::SessionCommunications::V1::SessionPrx& session,
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index eafdd82..7cbf235 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -214,13 +214,17 @@ void AsteriskSCF::BridgeService::BridgeManagerImpl::shutdown(const Ice::Current&
 void AsteriskSCF::BridgeService::BridgeManagerImpl::reap()
 {
     lg(Debug) << __FUNCTION__ << ": reaping bridge set of " << mBridges.size() << " bridges." ;
-    for(std::vector<BridgeInfo>::iterator i = mBridges.begin(); i != mBridges.end(); ++i)
+    std::vector<BridgeInfo>::iterator i = mBridges.begin();
+    while(i != mBridges.end())
     {
         if(i->servant->destroyed())
         {
+            i->servant->destroyImpl();
             std::vector<BridgeInfo>::iterator t = i;
-            mBridges.erase(t);
+            i = mBridges.erase(t);
+            continue;
         }
+        ++i;
     }
     lg(Debug) << __FUNCTION__ << ": reaping completed, bridge set size is now " << mBridges.size() << "." ;
 }

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


-- 
asterisk-scf/integration/bridging.git



More information about the asterisk-scf-commits mailing list