[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 Oct 20 09:52:02 CDT 2010
branch "master" has been updated
via d040f5c13d6f386b476b211397038b79175b3dd2 (commit)
from 4b691d901dde5b5220cbe5a5f60b657919849d97 (commit)
Summary of changes:
src/PJSipSessionModule.cpp | 2 ++
src/PJSipSessionModule.h | 4 ++++
2 files changed, 6 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit d040f5c13d6f386b476b211397038b79175b3dd2
Author: Joshua Colp <jcolp at digium.com>
Date: Wed Oct 20 07:50:48 2010 -0700
Add locking to protect the session replication object. Unlike the SIP specific objects it is possible for the session to get updated from both the pjsip thread AND an Ice dispatch thread at the same time.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 2a51d0a..d78f6a3 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -66,6 +66,7 @@ PJSipSessionModInfo::~PJSipSessionModInfo()
void PJSipSessionModInfo::updateSessionState(pjsip_inv_session *inv_session)
{
+ boost::unique_lock<boost::shared_mutex> lock(mLock);
if (mSession)
{
mSessionState->mEndpointName = mSession->getEndpoint()->getName();
@@ -177,6 +178,7 @@ void PJSipSessionModule::replicateState(PJSipDialogModInfo *dlgInfo, PJSipTransa
}
if (sessionInfo)
{
+ boost::shared_lock<boost::shared_mutex> lock(sessionInfo->mLock);
lg(Debug) << "--- Begin Session " << sessionInfo->mSessionState->key;
lg(Debug) << "Endpoint name: " << sessionInfo->mSessionState->mEndpointName;
lg(Debug) << "Session object identity: " << sessionInfo->mSessionState->mSessionObjectId.name;
diff --git a/src/PJSipSessionModule.h b/src/PJSipSessionModule.h
index 323ddcf..219d944 100644
--- a/src/PJSipSessionModule.h
+++ b/src/PJSipSessionModule.h
@@ -12,6 +12,9 @@
#include <pjsip_ua.h>
#include <pjlib.h>
+#include <boost/thread.hpp>
+#include <boost/thread/shared_mutex.hpp>
+
#include "SipStateReplicator.h"
#include "SipSession.h"
#include "PJSipModule.h"
@@ -36,6 +39,7 @@ public:
SipInviteSessionStateItemPtr mInviteState;
bool mNeedsReplication;
bool mNeedsRemoval;
+ boost::shared_mutex mLock;
private:
InviteSessionState inviteStateTranslate(pjsip_inv_state state);
SipSessionPtr mSession;
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list