[asterisk-scf-commits] asterisk-scf/release/sip.git branch "ami" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Dec 22 20:23:39 UTC 2010


branch "ami" has been updated
       via  78967c0c5963c814d5fb059c26c54cf712f22c62 (commit)
      from  c4e5ac5795ab7bd6b7dd9df51b221ffd4f0a3e07 (commit)

Summary of changes:
 src/PJSipSessionModule.cpp |   43 +++++++++++++------------------------------
 1 files changed, 13 insertions(+), 30 deletions(-)


- Log -----------------------------------------------------------------
commit 78967c0c5963c814d5fb059c26c54cf712f22c62
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Dec 22 14:29:30 2010 -0600

    Revert "Make the StoppedCallback more safe."
    
    This reverts commit c4e5ac5795ab7bd6b7dd9df51b221ffd4f0a3e07.
    
    In tests, this was causing a deadlock every single time. I need to
    analyze this more in-depth.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 680615f..d259974 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -47,9 +47,6 @@ using namespace AsteriskSCF::SessionCommunications::V1;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::SIP::V1;
 
-class PJSipSessionModInfo;
-class PJSipDialogModInfo;
-
 class RouteSessionCallback : public IceUtil::Shared
 {
 public:
@@ -156,34 +153,10 @@ typedef IceUtil::Handle<ConnectBridgedSessionsWithDestinationCallback> ConnectBr
 class StoppedCallback : public IceUtil::Shared
 {
 public:
-    StoppedCallback(PJSipSessionModule *module, pjsip_inv_session *inv, const int id) : mModule(module), mInvSession(inv), mModuleId(id) {}
-    void success()
-    {
-        cleanup();
-    }
+    StoppedCallback() {}
     void failure(const Ice::Exception &ex)
     {
         lg(Error) << "Ice exception when attempting to relate stopped state: " << ex.what() << std::endl;
-        // Still need to do the same cleanup as for a successful call
-        cleanup();
-    }
-private:
-    PJSipSessionModule *mModule;
-    pjsip_inv_session *mInvSession;
-    const int mModuleId;
-    void cleanup()
-    {
-        pjsip_dialog *dlg = mInvSession->dlg;
-        PJSipSessionModInfo *sessionInfo = (PJSipSessionModInfo *) mInvSession->mod_data[mModuleId];
-        PJSipDialogModInfo *dialogInfo = (PJSipDialogModInfo *) dlg->mod_data[mModuleId];
-        sessionInfo->mNeedsRemoval = true;
-        dialogInfo->mNeedsRemoval = true;
-        lg(Debug) << "Replicating state on DISCONNECTED inv_state.";
-        mModule->replicateState(dialogInfo, NULL, sessionInfo);
-        delete sessionInfo;
-        delete dialogInfo;
-        dlg->mod_data[mModuleId] = 0;
-        mInvSession->mod_data[mModuleId] = 0;
     }
 };
 
@@ -966,9 +939,9 @@ void PJSipSessionModule::invOnStateChanged(pjsip_inv_session *inv, pjsip_event *
         {
             try
             {
-                StoppedCallbackPtr cb(new StoppedCallback(this, inv, mModule.id));
+                StoppedCallbackPtr cb(new StoppedCallback());
                 Callback_SessionListener_stoppedPtr stoppedCB =
-                    newCallback_SessionListener_stopped(cb, &StoppedCallback::success, &StoppedCallback::failure);
+                    newCallback_SessionListener_stopped(cb, &StoppedCallback::failure);
                 (*listener)->begin_stopped(session->getSessionProxy(), response, stoppedCB);
             }
             catch (const Ice::Exception &ex)
@@ -976,6 +949,16 @@ void PJSipSessionModule::invOnStateChanged(pjsip_inv_session *inv, pjsip_event *
                 lg(Error) << "Ice exception when attempting to relate stopped state: " << ex.what() << std::endl;
             }
         }
+        session_mod_info->mNeedsRemoval = true;
+        pjsip_dialog *dlg = inv->dlg;
+        PJSipDialogModInfo *dlg_mod_info = (PJSipDialogModInfo*) dlg->mod_data[mModule.id];
+        dlg_mod_info->mNeedsRemoval = true;
+        lg(Debug) << "Replicating state on DISCONNECTED inv_state.";
+        replicateState(dlg_mod_info, NULL, session_mod_info);
+        delete session_mod_info;
+        delete dlg_mod_info;
+        dlg->mod_data[mModule.id] = 0;
+        inv->mod_data[mModule.id] = 0;
     }
     if (event->type == PJSIP_EVENT_RX_MSG && inv->state == PJSIP_INV_STATE_CONFIRMED)
     {

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


-- 
asterisk-scf/release/sip.git



More information about the asterisk-scf-commits mailing list