[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "mediasessioncoookies" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Sep 8 17:21:34 CDT 2011
branch "mediasessioncoookies" has been created
at cd599bb26094f4865eabc4747762f31bbeb236ae (commit)
- Log -----------------------------------------------------------------
commit cd599bb26094f4865eabc4747762f31bbeb236ae
Author: Ken Hunt <ken.hunt at digium.com>
Date: Thu Sep 8 17:22:44 2011 -0500
Added locking to the cookie operations.
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 3bdd0a8..9839a19 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -568,6 +568,7 @@ std::string RTPSessionImpl::getId(const Ice::Current&)
*/
void RTPSessionImpl::setCookies(const AsteriskSCF::Media::V1::SessionCookieDict& cookieMap)
{
+ boost::unique_lock<boost::shared_mutex> lock(mLock);
mSessionStateItem->cookies = cookieMap;
}
@@ -577,10 +578,13 @@ void RTPSessionImpl::setCookies(const AsteriskSCF::Media::V1::SessionCookieDict&
void RTPSessionImpl::setCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies,
const Ice::Current&)
{
- for (AsteriskSCF::Media::V1::SessionCookies::const_iterator i = cookies.begin();
- i != cookies.end(); ++i)
- {
- mSessionStateItem->cookies[(*i)->ice_id()] = (*i);
+ { // scope the lock
+ boost::unique_lock<boost::shared_mutex> lock(mLock);
+ for (AsteriskSCF::Media::V1::SessionCookies::const_iterator i = cookies.begin();
+ i != cookies.end(); ++i)
+ {
+ mSessionStateItem->cookies[(*i)->ice_id()] = (*i);
+ }
}
if (mReplicationContext->isReplicating() == true)
@@ -599,6 +603,7 @@ void RTPSessionImpl::getCookies_async(
{
AsteriskSCF::Media::V1::SessionCookies results;
+ boost::unique_lock<boost::shared_mutex> lock(mLock);
for (AsteriskSCF::Media::V1::SessionCookies::const_iterator i = cookiesToGet.begin();
i != cookiesToGet.end();
++i)
@@ -622,10 +627,13 @@ void RTPSessionImpl::getCookies_async(
void RTPSessionImpl::removeCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies,
const Ice::Current&)
{
- for (AsteriskSCF::Media::V1::SessionCookies::const_iterator i = cookies.begin();
- i != cookies.end(); ++i)
- {
- mSessionStateItem->cookies.erase((*i)->ice_id());
+ { // scope the lock
+ boost::unique_lock<boost::shared_mutex> lock(mLock);
+ for (AsteriskSCF::Media::V1::SessionCookies::const_iterator i = cookies.begin();
+ i != cookies.end(); ++i)
+ {
+ mSessionStateItem->cookies.erase((*i)->ice_id());
+ }
}
if (mReplicationContext->isReplicating() == true)
-----------------------------------------------------------------------
--
asterisk-scf/integration/media_rtp_pjmedia.git
More information about the asterisk-scf-commits
mailing list