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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Feb 16 09:47:19 CST 2011


branch "authexten" has been updated
       via  d23a05405132459594db5c41bd4485207a887cce (commit)
      from  18220a9ec61fbb51381e8405c4b9c7e0e1c785a8 (commit)

Summary of changes:
 src/AuthManager.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit d23a05405132459594db5c41bd4485207a887cce
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Feb 16 09:46:49 2011 -0600

    Lock the hooks lock when constructing an AuthInstance.

diff --git a/src/AuthManager.cpp b/src/AuthManager.cpp
index 659b67b..a17ecbd 100644
--- a/src/AuthManager.cpp
+++ b/src/AuthManager.cpp
@@ -330,9 +330,13 @@ AuthManager::~AuthManager()
 
 boost::shared_ptr<AuthInstance> AuthManager::createAuthInstance(pjsip_rx_data *rdata, RequestType type)
 {
-    boost::shared_ptr<AuthInstance> instance(new AuthInstance(rdata, mImpl->mRegisteredHooks,
+    boost::shared_ptr<AuthInstance> instance;
+    {
+        boost::lock_guard<boost::mutex> hookLock(mImpl->mHooksLock);
+        instance.reset(new AuthInstance(rdata, mImpl->mRegisteredHooks,
                 type, mImpl->mPool, mImpl->mLogger));
-    boost::lock_guard<boost::mutex> lock(mImpl->mAuthInstancesLock);
+    }
+    boost::lock_guard<boost::mutex> instancesLock(mImpl->mAuthInstancesLock);
     mImpl->mAuthInstances.push_back(instance);
     return instance;
 }

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


-- 
asterisk-scf/release/sip.git



More information about the asterisk-scf-commits mailing list