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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Sep 22 12:52:19 CDT 2010


branch "master" has been updated
       via  521b4891fec9f3dab6a9da7284c1254ef52ce47c (commit)
      from  0b46a431c7f482d62d3a45b6d7efcb0052de420b (commit)

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


- Log -----------------------------------------------------------------
commit 521b4891fec9f3dab6a9da7284c1254ef52ce47c
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Sep 22 12:52:42 2010 -0500

    Add destruction/removal of state replication items where appropriate.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 3a486c3..6c2e25f 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -56,6 +56,10 @@ public:
       mDialogState->mId = IceUtil::generateUUID();
 	  updateDialogState(dialog);
    }
+   ~PJSipDialogModInfo()
+   {
+      mDialogState = 0;
+   }
    /**
 	* Copies data from the pjsip_dialog structure into
 	* our state data.
@@ -130,6 +134,10 @@ public:
       mTransactionState->mId = IceUtil::generateUUID();
 	  updateTransactionState(transaction);
    }
+   ~PJSipTransactionModInfo()
+   {
+      mTransactionState = 0;
+   }
    void updateTransactionState(pjsip_transaction *transaction)
    {
       mTransactionState->mBranch = std::string(pj_strbuf(&transaction->branch), pj_strlen(&transaction->branch));
@@ -229,38 +237,38 @@ static void replicateState(PJSipDialogModInfo *dlgInfo, PJSipTransactionModInfo
 	SipStateItemSeq removeItems;
 	if (dlgInfo)
 	{
-		if (dlgInfo->mNeedsReplication == true)
+		if (dlgInfo->mNeedsRemoval == true)
 		{
-			setItems.push_back(dlgInfo->mDialogState);
-			dlgInfo->mNeedsReplication = false;
+			removeItems.push_back(dlgInfo->mDialogState);
 		}
-		else if (dlgInfo->mNeedsRemoval == true)
+		else if (dlgInfo->mNeedsReplication == true)
 		{
-			removeItems.push_back(dlgInfo->mDialogState);
+			setItems.push_back(dlgInfo->mDialogState);
+			dlgInfo->mNeedsReplication = false;
 		}
 	}
 	if (tsxInfo)
 	{
-		if (tsxInfo->mNeedsReplication == true)
+		if (tsxInfo->mNeedsRemoval == true)
 		{
-			setItems.push_back(tsxInfo->mTransactionState);
-			tsxInfo->mNeedsReplication = false;
+			removeItems.push_back(tsxInfo->mTransactionState);
 		}
-		else if (tsxInfo->mNeedsRemoval == true)
+		else if (tsxInfo->mNeedsReplication == true)
 		{
-			removeItems.push_back(tsxInfo->mTransactionState);
+			setItems.push_back(tsxInfo->mTransactionState);
+			tsxInfo->mNeedsReplication = false;
 		}
 	}
 	if (sessionInfo)
 	{
-		if (sessionInfo->mNeedsReplication == true)
+		if (sessionInfo->mNeedsRemoval == true)
 		{
-			setItems.push_back(sessionInfo->mSessionState);
-			sessionInfo->mNeedsReplication = false;
+			removeItems.push_back(sessionInfo->mSessionState);
 		}
-		else if (sessionInfo->mNeedsRemoval == true)
+		else if (sessionInfo->mNeedsReplication == true)
 		{
-			removeItems.push_back(sessionInfo->mSessionState);
+			setItems.push_back(sessionInfo->mSessionState);
+			sessionInfo->mNeedsReplication = false;
 		}
 	}
 	SipStateReplicatorPrx replicator = SipChannelServiceDataModel::getInstance().getStateReplicator();
@@ -551,7 +559,14 @@ static void invOnStateChanged(pjsip_inv_session *inv, pjsip_event *event)
       {
 	 (*listener)->stopped(session->getSessionProxy(), response);
       }
+	  session_mod_info->mNeedsRemoval = true;
+	  pjsip_dialog *dlg = inv->dlg;
+	  PJSipDialogModInfo *dlg_mod_info = (PJSipDialogModInfo*) dlg->mod_data[pjsip_ua_instance()->id];
+	  dlg_mod_info->mNeedsRemoval = true;
+	  replicateState(dlg_mod_info, NULL, session_mod_info);
       delete session_mod_info;
+	  delete dlg_mod_info;
+	  dlg->mod_data[pjsip_ua_instance()->id] = 0;
       inv->mod_data[pjsip_ua_instance()->id] = 0;
    }
    if (event->type == PJSIP_EVENT_RX_MSG && inv->state == PJSIP_INV_STATE_CONFIRMED)

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list