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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Sep 10 11:06:26 CDT 2010


branch "master" has been updated
       via  422b49fd2ebb96a49a24fdb314bb4306d9b23367 (commit)
      from  57685c11fcb0455ff81fa2cd0925cdd0ffcf031f (commit)

Summary of changes:
 src/ListenerManager.h |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)


- Log -----------------------------------------------------------------
commit 422b49fd2ebb96a49a24fdb314bb4306d9b23367
Author: Brent Eagles <beagles at digium.com>
Date:   Fri Sep 10 13:31:45 2010 -0230

    Fix some bad code that didn't show up until the template method
    instantiated.

diff --git a/src/ListenerManager.h b/src/ListenerManager.h
index ba09644..05ed943 100644
--- a/src/ListenerManager.h
+++ b/src/ListenerManager.h
@@ -4,6 +4,7 @@
 #include <IceStorm/IceStorm.h>
 #include <boost/thread/shared_mutex.hpp>
 #include <string>
+#include <algorithm>
 #include <vector>
 #include "InternalExceptions.h"
 
@@ -36,22 +37,21 @@ namespace TestUtil
                         "Unable to initialize listener support.");
             }
 
-            IceStorm::TopicManagerPrx topicManager;
             try
             {
-                topicManager = IceStorm::TopicManagerPrx::checkedCast(mCommunicator->stringToProxy(topicManagerProperty));
+                mTopicManager = IceStorm::TopicManagerPrx::checkedCast(mCommunicator->stringToProxy(topicManagerProperty));
             }
             catch(const Ice::Exception&)
             {
             }
-            if(!topicManager)
+            if(!mTopicManager)
             {
                 throw ConfigException(propertyName, "Topic manager proxy is not a valid proxy or is unreachable");
             }
 
             try
             {
-                mTopic = topicManager->retrieve(mTopicName);
+                mTopic = mTopicManager->retrieve(mTopicName);
             }
             catch(const IceStorm::NoSuchTopic&)
             {
@@ -61,14 +61,14 @@ namespace TestUtil
             {
                 try
                 {
-                    mTopic = topicManager->create(mTopicName);
+                    mTopic = mTopicManager->create(mTopicName);
                 }
                 catch(const IceStorm::TopicExists&)
                 {
                     //
                     // In case there is a race condition when creating the topic.
                     //
-                    mTopic = topicManager->retrieve(mTopicName);
+                    mTopic = mTopicManager->retrieve(mTopicName);
                 }
             }
 
@@ -93,7 +93,7 @@ namespace TestUtil
         void addListener(const T& listener)
         {
             boost::unique_lock<boost::shared_mutex> lock(mLock);
-            if(mListeners.find(listener) == mListeners.end())
+            if(std::find(mListeners.begin(), mListeners.end(), listener) == mListeners.end())
             {
                 mListeners.push_back(listener);
             }
@@ -114,7 +114,7 @@ namespace TestUtil
         void removeListener(const T& listener)
         {
             boost::unique_lock<boost::shared_mutex> lock(mLock);
-            typename std::vector<T>::iterator i = mListeners.find(listener);
+            typename std::vector<T>::iterator i = std::find(mListeners.begin(), mListeners.end(), listener);
             if(i != mListeners.end())
             {
                 mListeners.erase(i);
@@ -134,6 +134,7 @@ namespace TestUtil
         Ice::CommunicatorPtr mCommunicator;
         std::string mTopicName;
         IceStorm::TopicPrx mTopic;
+        IceStorm::TopicManagerPrx mTopicManager;
         ListenerSeq mListeners;
     };
 }

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


-- 
asterisk-scf/integration/test_channel.git



More information about the asterisk-scf-commits mailing list