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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Jun 3 11:04:39 CDT 2011


branch "master" has been updated
       via  2e92a5419e33830e5896a7121eacb79d8450b28a (commit)
      from  29d4f2f06467b3b03b09b79588d37ab7c5b452ca (commit)

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


- Log -----------------------------------------------------------------
commit 2e92a5419e33830e5896a7121eacb79d8450b28a
Author: Brent Eagles <beagles at digium.com>
Date:   Fri Jun 3 13:33:57 2011 -0230

    Fixes to address an issue where indications were being sent to sessions that
    the bridge should have already disregarded.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index fcfab3b..60b6bb2 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -784,6 +784,13 @@ void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callba
         SessionsTrackerPtr removeTracker(new SessionsTracker);
         removeTracker->add(session->getSession());
         session->shutdown(mSessionListenerPrx, new ResponseCode);
+
+        //
+        // Since the shutdown of the session is inherently asynchronous, the
+        // rest of this is going to happen anyways, so lets remove it from the
+        // list of known sessions now so it doesn't get in the way.
+        //
+        mSessions->removeSession(session->getBridgedSession());
         
         SessionsTrackerPtr tracker(new SessionsTracker);
         QueuedTasks tasks;
diff --git a/src/SessionCollection.h b/src/SessionCollection.h
index d961f87..da7100c 100644
--- a/src/SessionCollection.h
+++ b/src/SessionCollection.h
@@ -95,12 +95,23 @@ public:
      *
      **/
     template <typename Func>
-    Func& visitSessions(Func& op)
+    Func& visitSessions(Func& op, bool ignoreExceptions = true)
     {
         boost::shared_lock<boost::shared_mutex> lock(mLock);
         for (SessionMap::iterator i = mMap.begin(); i != mMap.end(); ++i)
         {
-            op(i->second);
+            try
+            {
+                op(i->second);
+            }
+            catch (const std::exception& ex)
+            {
+                mLogger(Error) << "visitSessions caught " << ex.what();
+                if (!ignoreExceptions)
+                {
+                    throw;
+                }
+            }
         }
         return op;
     }
diff --git a/src/SessionListener.cpp b/src/SessionListener.cpp
index 0521181..71c6d4d 100644
--- a/src/SessionListener.cpp
+++ b/src/SessionListener.cpp
@@ -219,6 +219,7 @@ public:
             //
             // TODO: Who gets the ring notifications will likely depend on configuration, etc.
             //
+            mSessions->reap();
             RelayIndication relayer(source, mLogger, commandIndication, false);
             mSessions->visitSessions(relayer);
         }

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


-- 
asterisk-scf/release/bridging.git



More information about the asterisk-scf-commits mailing list