[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
Wed Jul 18 14:48:20 CDT 2012


branch "master" has been updated
       via  95604fedf4fcba631c10004e1b99e01defbcb2b2 (commit)
      from  543b2ec2d77f1d1279f40cffc1a225ed04ce1dbc (commit)

Summary of changes:
 src/SessionListener.cpp |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)


- Log -----------------------------------------------------------------
commit 95604fedf4fcba631c10004e1b99e01defbcb2b2
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Jul 18 17:16:42 2012 -0230

    Have the session listener use AMI to tell the bridge object to shutdown.
    Failing to do so can cause weird deadlocks because there aren't enough adapter
    thread pool threads to handle the requests. AMI will break things up enough.

diff --git a/src/SessionListener.cpp b/src/SessionListener.cpp
index de47ecf..88112e2 100644
--- a/src/SessionListener.cpp
+++ b/src/SessionListener.cpp
@@ -50,6 +50,26 @@ void indicationCopy(const ProgressingIndicationPtr& source, const ProgressIndica
     destination->response = source->response;
 }
 
+class BridgeShutdownCallback : public IceUtil::Shared 
+{
+public:
+    void doneShuttingDown(const Ice::AsyncResultPtr& r)
+    {
+        BridgePrx p = BridgePrx::uncheckedCast(r->getProxy());
+        try
+        {
+            p->end_shutdown(r);
+        }
+        catch (const Ice::Exception&)
+        {
+        }
+        catch (...)
+        {
+            assert(false);
+        }
+    }
+};
+
 /**
  * Helper template function that translates a received indication to a
  * corresponding result indication to be passed along to the other
@@ -273,7 +293,17 @@ public:
                             //
                             if (currentSessions.size() < 2)
                             {
-                                mBridgePrx->shutdown(AsteriskSCF::Operations::createContext(context));
+                                Ice::CallbackPtr cb = Ice::newCallback(new BridgeShutdownCallback, &BridgeShutdownCallback::doneShuttingDown);
+                                //
+                                // We need to use AMI here because we are
+                                // actually in an upcall thread and collocation
+                                // optimization is turned off. This means this
+                                // will block until a server thread can become
+                                // available.. which might not ever happen if
+                                // there are 4 indications trying to do the
+                                // same thing!
+                                //
+                                mBridgePrx->begin_shutdown(AsteriskSCF::Operations::createContext(context), cb);
                             }
                         }
                         catch (const Ice::ObjectNotExistException&)

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


-- 
asterisk-scf/release/bridging.git



More information about the asterisk-scf-commits mailing list