[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "threading" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon May 23 15:27:26 CDT 2011
branch "threading" has been updated
via f233332d7f4039a7fb007a42c207eb988dd9c77e (commit)
via 71753eef2f0662b2642b0f5beef628c07c891bba (commit)
from 069e20776fc5e0d44dbe7d5e4963167d93e64d6a (commit)
Summary of changes:
src/PJSipManager.h | 11 ++++++++++-
src/PJSipSessionModule.cpp | 14 +++++++++++++-
src/PJSipSessionModule.h | 3 ++-
src/SipSession.cpp | 15 +++++++++++++--
4 files changed, 38 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit f233332d7f4039a7fb007a42c207eb988dd9c77e
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon May 23 14:43:48 2011 -0500
Change encapsulation of queued operation members.
Specifically made members either protected or public in places where
I could.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 3882704..3f75ca5 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -332,6 +332,7 @@ public:
const std::string destination)
: mSessionModule(module), mCaller(caller), mSessionRouter(router), mInv(inv), mTdata(tdata), mReplacedDialog(replacedDialog), mDestination(destination) { }
+protected:
SuspendableWorkResult initial(const SuspendableWorkListenerPtr&)
{
lg(Debug) << "Executing SessionCreationOperation" << std::endl;
@@ -402,6 +403,7 @@ public:
return Complete;
}
+private:
PJSipSessionModulePtr mSessionModule;
SipEndpointPtr mCaller;
AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx> mSessionRouter;
@@ -580,6 +582,7 @@ public:
mTargetSipUri(target_sip_uri), mSession(session), mSessionRouter(sessionRouter),
mModuleId(moduleId), mWasWithDestination(false) { }
+protected:
/**
* This is what is initially called when the operation is queued.
*
@@ -774,6 +777,7 @@ public:
return Complete;
}
+private:
/**
* The INVITE session, which contains the dialog on which the
* REFER was received.
@@ -923,6 +927,7 @@ public:
HandleInviteResponseOperation(int respCode, const int invState, const SipSessionPtr& session)
: mRespCode(respCode), mInvState(invState), mSession(session) { }
+protected:
SuspendableWorkResult initial(const SuspendableWorkListenerPtr&)
{
lg(Debug) << "Executing HandleInviteResponseOperation" << std::endl;
@@ -1020,7 +1025,7 @@ public:
}
return Complete;
}
-
+private:
int mRespCode;
const int mInvState;
SipSessionPtr mSession;
@@ -1055,6 +1060,7 @@ public:
const int tsxState)
: mSessionModule(module), mTsx(tsx), mInv(inv), mEventType(eventType), mTsxState(tsxState) { }
+protected:
SuspendableWorkResult initial(const SuspendableWorkListenerPtr&)
{
lg(Debug) << "Executing TransactionStateOperation";
@@ -1095,6 +1101,7 @@ public:
return Complete;
}
+private:
PJSipSessionModulePtr mSessionModule;
pjsip_transaction *mTsx;
pjsip_inv_session *mInv;
@@ -1108,6 +1115,7 @@ public:
InviteStateOperation(const PJSipSessionModulePtr& module, pjsip_inv_session* inv, const int eventType, const int invState, const std::string branch)
: mSessionModule(module), mInv(inv), mEventType(eventType), mInvState(invState), mEventBranch(branch) { }
+protected:
SuspendableWorkResult initial(const SuspendableWorkListenerPtr&)
{
if (mInvState == PJSIP_INV_STATE_DISCONNECTED)
@@ -1203,6 +1211,7 @@ public:
return Complete;
}
+private:
PJSipSessionModulePtr mSessionModule;
pjsip_inv_session* mInv;
const int mEventType;
@@ -1308,6 +1317,7 @@ public:
HandleMediaUpdate(pjsip_inv_session *inv, const int moduleId, const ServiceLocatorPrx& serviceLocator)
: mInv(inv), mModuleId(moduleId), mServiceLocator(serviceLocator) { }
+protected:
SuspendableWorkResult initial(const SuspendableWorkListenerPtr&)
{
const pjmedia_sdp_session *remote_sdp;
@@ -1411,6 +1421,7 @@ public:
return Complete;
}
+private:
pjsip_inv_session* mInv;
const int mModuleId;
ServiceLocatorPrx mServiceLocator;
@@ -1530,6 +1541,7 @@ public:
mQueueListener->workResumable();
}
+private:
QueueListenerPtr mQueueListener;
};
diff --git a/src/PJSipSessionModule.h b/src/PJSipSessionModule.h
index 0a8a872..73fd186 100644
--- a/src/PJSipSessionModule.h
+++ b/src/PJSipSessionModule.h
@@ -184,6 +184,7 @@ public:
return result;
}
+protected:
/**
* All SipQueueableOperations are required to provide an overload
* of this function. This is where initial processing takes place.
@@ -203,7 +204,7 @@ public:
{
return AsteriskSCF::System::WorkQueue::V1::Complete;
}
-protected:
+
enum states
{
/**
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index d3fad49..b9564eb 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -371,7 +371,7 @@ public:
mCb->ice_response(sessionInfo);
return Complete;
}
-
+private:
AsteriskSCF::SessionCommunications::V1::AMD_Session_addListenerPtr mCb;
AsteriskSCF::SessionCommunications::V1::SessionListenerPrx mListener;
boost::shared_ptr<SipSessionPriv> mImplPriv;
@@ -449,6 +449,7 @@ public:
return Complete;
}
+private:
AsteriskSCF::SessionCommunications::V1::AMD_Session_indicatePtr mCb;
AsteriskSCF::SessionCommunications::V1::IndicationPtr mIndication;
boost::shared_ptr<SipSessionPriv> mImplPriv;
@@ -482,6 +483,7 @@ public:
return Complete;
}
+private:
AsteriskSCF::SessionCommunications::V1::AMD_Session_getEndpointPtr mCb;
boost::shared_ptr<SipSessionPriv> mImplPriv;
};
@@ -515,6 +517,7 @@ public:
return Complete;
}
+private:
AsteriskSCF::SessionCommunications::V1::AMD_Session_getInfoPtr mCb;
boost::shared_ptr<SipSessionPriv> mImplPriv;
};
@@ -545,6 +548,7 @@ public:
return Complete;
}
+private:
AsteriskSCF::SessionCommunications::V1::AMD_Session_getMediaSessionPtr mCb;
boost::shared_ptr<SipSessionPriv> mImplPriv;
};
@@ -583,7 +587,8 @@ public:
mCb->ice_response(bridge);
return Complete;
}
-
+
+private:
AsteriskSCF::SessionCommunications::V1::AMD_Session_getBridgePtr mCb;
boost::shared_ptr<SipSessionPriv> mImplPriv;
};
@@ -620,6 +625,7 @@ public:
return Complete;
}
+private:
AsteriskSCF::SessionCommunications::V1::AMD_Session_setBridgePtr mCb;
SipSessionPtr mSession;
boost::shared_ptr<SipSessionPriv> mImplPriv;
@@ -680,6 +686,7 @@ public:
return Complete;
}
+private:
AsteriskSCF::SessionCommunications::V1::AMD_Session_removeBridgePtr mCb;
SipSessionPtr mSession;
boost::shared_ptr<SipSessionPriv> mImplPriv;
@@ -713,6 +720,7 @@ public:
mImplPriv->removeListener(mListener);
return Complete;
}
+private:
AsteriskSCF::SessionCommunications::V1::SessionListenerPrx mListener;
boost::shared_ptr<SipSessionPriv> mImplPriv;
};
@@ -754,6 +762,7 @@ public:
return Complete;
}
+private:
SipSessionPtr mSession;
boost::shared_ptr<SipSessionPriv> mImplPriv;
};
@@ -799,6 +808,7 @@ public:
return Complete;
}
+private:
AsteriskSCF::SessionCommunications::V1::ResponseCodePtr mResponse;
pjsip_inv_session *mInviteSession;
};
@@ -848,6 +858,7 @@ public:
return Complete;
}
+private:
SipSessionPtr mSession;
boost::shared_ptr<SipSessionPriv> mSessionPriv;
};
commit 71753eef2f0662b2642b0f5beef628c07c891bba
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon May 23 14:17:39 2011 -0500
Protect the pjlibHook map with a mutex.
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index f36b0ac..ef7e457 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -24,6 +24,7 @@
#include <Ice/Ice.h>
#include <boost/shared_ptr.hpp>
+#include <boost/thread/locks.hpp>
#include <AsteriskSCF/Discovery/SmartProxy.h>
@@ -142,7 +143,10 @@ public:
ThreadDescWrapperPtr wrapper = ThreadDescWrapperPtr(new ThreadDescWrapper());
pj_thread_t *thread;
pj_thread_register("ICE Thread", wrapper->mDesc, &thread);
- pjThreads.insert(std::make_pair(thread, wrapper));
+ {
+ boost::lock_guard<boost::mutex> lock(mLock);
+ pjThreads.insert(std::make_pair(thread, wrapper));
+ }
}
/**
@@ -152,6 +156,7 @@ public:
{
if (pj_thread_is_registered())
{
+ boost::lock_guard<boost::mutex> lock(mLock);
pjThreads.erase(pj_thread_this());
}
}
@@ -161,6 +166,10 @@ private:
* A map containing thread lifetime persistent data.
*/
std::map<pj_thread_t*, ThreadDescWrapperPtr> pjThreads;
+ /**
+ * Mutex to protect the map
+ */
+ boost::mutex mLock;
};
}; //End namespace SipSessionManager
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list