[asterisk-scf-commits] team/ken.hunt/route_async_routing.git branch "route_async" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Dec 23 00:41:10 UTC 2010


branch "route_async" has been updated
       via  d767903433ae98633a3f954ddb74af172227d6cd (commit)
       via  efccdcd2fddb93ade864340a1419b844f1c9decd (commit)
       via  dda79d3a59752b5368a0a18ba7263fee22982e30 (commit)
       via  4a97865504713362dbb8ffbfc312c902f6772fcf (commit)
       via  98cdbcf16080b782965b54c9c45df06ac51249c2 (commit)
      from  50f6599c715906127223392848e4257fcbc90988 (commit)

Summary of changes:
 slice                      |    2 +-
 src/SessionRouter.cpp      |   15 +++++++++++--
 src/SimpleWorkQueue.cpp    |   45 +++++++++++++++++++++----------------------
 test/MockBridgeManager.cpp |    8 +++++++
 test/MockBridgeManager.h   |    3 ++
 test/TestRouting.cpp       |    2 +-
 6 files changed, 47 insertions(+), 28 deletions(-)


- Log -----------------------------------------------------------------
commit d767903433ae98633a3f954ddb74af172227d6cd
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Dec 22 18:39:41 2010 -0600

    More changes for gcc specific errors.

diff --git a/src/SessionRouter.cpp b/src/SessionRouter.cpp
index cd68ad9..b35bc34 100644
--- a/src/SessionRouter.cpp
+++ b/src/SessionRouter.cpp
@@ -778,7 +778,7 @@ public:
                           const ::Ice::Current& current,
                           const SessionContext& context,
                           OperationsManager* const listener) 
-         : SessionRouterOperation(cb, 
+         : SessionRouterOperation<AMD_SessionRouter_routeSessionPtr>(cb, 
                                   context, 
                                   listener, 
                                   boost::bind(&RouteSessionOperation::lookupState, this)),
@@ -925,7 +925,7 @@ public:
                           const ::Ice::Current& current,
                           const SessionContext& context,
                           OperationsManager* const listener)
-         : SessionRouterOperation(cb, 
+         : SessionRouterOperation<AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr>(cb, 
                                   context, 
                                   listener, 
                                   boost::bind(&ConnectBridgedSessionsWithDestinationOperation::lookupState, this)),
@@ -1063,7 +1063,10 @@ public:
                           const ::Ice::Current& current,
                           const SessionContext& context,
                           OperationsManager* const listener)
-         : SessionRouterOperation(cb, context, listener, boost::bind(&ConnectBridgedSessionsOperation::connectBridgedSessionsState, this)),
+         : SessionRouterOperation<AMD_SessionRouter_connectBridgedSessionsPtr>(cb, 
+                                             context, 
+                                             listener, 
+                                             boost::bind(&ConnectBridgedSessionsOperation::connectBridgedSessionsState, this)),
            mInitiatorCallback(cb),
            mSessionToReplace(sessionToReplace),
            mBridgedSession(bridgedSession),
diff --git a/src/SimpleWorkQueue.cpp b/src/SimpleWorkQueue.cpp
index 48cabc2..4450deb 100644
--- a/src/SimpleWorkQueue.cpp
+++ b/src/SimpleWorkQueue.cpp
@@ -38,16 +38,16 @@ namespace AsteriskSCF
 class SimpleWorkQueuePriv
 {
 public:
-	SimpleWorkQueuePriv(const std::string& id, const Logger& logger) 
-	     : mLogger(logger),
-		   mQid(id),
-		   mInitialized(false), 
-	       mPaused(false),      // runs by default. 
-		   mFinished(false), 
-		   mThread(boost::bind(&SimpleWorkQueuePriv::execute, this))
-		   
+    SimpleWorkQueuePriv(const std::string& id, const Logger& logger) 
+         : mLogger(logger),
+           mQid(id),
+           mInitialized(false), 
+           mFinished(false), 
+           mPaused(false),      // runs by default. 
+           mThread(boost::bind(&SimpleWorkQueuePriv::execute, this))
+           
   {
-    mLogger(Debug) << "SimpleWorkQueue::private_impl constructor called. Queue ID:" << mQid;
+      mLogger(Debug) << "SimpleWorkQueue::private_impl constructor called. Queue ID:" << mQid;
   }
 
   ~SimpleWorkQueuePriv()
@@ -65,8 +65,8 @@ public:
   bool mInitialized;
   bool mFinished;
   bool mPaused;
-  std::list<WorkPtr> mQueue;
   boost::thread mThread;
+  std::list<WorkPtr> mQueue;
   boost::mutex mQueueMutex;
   boost::condition mEmptyQueueCondition;
   boost::mutex mPauseMutex;
@@ -85,13 +85,13 @@ SimpleWorkQueue::~SimpleWorkQueue()
     mImpl->mLogger(Debug) << "SimpleWorkQueue::Destructor() called. Queue ID:" << mImpl->mQid;
     terminate();
 
-	// Wait for worker thread to shut down. 
-	mImpl->mThread.join(); // If you don't do this, then the mImpl is trashed and Execute has bad "this" ptr on other thread. 
+    // Wait for worker thread to shut down. 
+    mImpl->mThread.join(); // If you don't do this, then the mImpl is trashed and Execute has bad "this" ptr on other thread. 
 }
 
 bool SimpleWorkQueue::isRunning() 
 { 
-	return (mImpl->mInitialized && !mImpl->mPaused && !mImpl->mFinished);
+    return (mImpl->mInitialized && !mImpl->mPaused && !mImpl->mFinished);
 }
 
 /**
@@ -99,7 +99,7 @@ bool SimpleWorkQueue::isRunning()
  */
 void SimpleWorkQueue::pause()
 {
-	mImpl->mLogger(Info) << "SimpleWorkQueue::Pause called for queue " << mImpl->mQid;
+    mImpl->mLogger(Info) << "SimpleWorkQueue::Pause called for queue " << mImpl->mQid;
 
     boost::lock_guard<boost::mutex> lock(mImpl->mPauseMutex);
     mImpl->mPaused = true;
@@ -161,7 +161,6 @@ WorkQueue::PoolId SimpleWorkQueue::enqueue(const WorkPtr& w)
         boost::lock_guard<boost::mutex> lock(mImpl->mQueueMutex);
         wasEmpty = mImpl->mQueue.empty();
         mImpl->mQueue.push_back(w);
-        int size = mImpl->mQueue.size();
     }
  
    if (wasEmpty)
@@ -196,18 +195,18 @@ WorkPtr SimpleWorkQueuePriv::waitAndDequeue()
 
     while (mQueue.empty())
     {
-		mLogger(Debug) << "SimpleWorkQueue::WaitAndDequeue: Waiting on empty queue. Queue ID:" << mQid;
+        mLogger(Debug) << "SimpleWorkQueue::WaitAndDequeue: Waiting on empty queue. Queue ID:" << mQid;
 
-		if (mFinished)
+        if (mFinished)
         {
-		   mLogger(Info) << "SimpleWorkQueue::WaitAndDequeue: Returning the NO_WORK token. Queue ID:" << mQid;
+           mLogger(Info) << "SimpleWorkQueue::WaitAndDequeue: Returning the NO_WORK token. Queue ID:" << mQid;
            return NO_WORK_PTR;
         }
 
         mEmptyQueueCondition.wait(lock);
     }
     
-	mLogger(Debug) << "SimpleWorkQueue::WaitAndDequeue: Dequeuing some work. Queue ID:" << mQid;
+    mLogger(Debug) << "SimpleWorkQueue::WaitAndDequeue: Dequeuing some work. Queue ID:" << mQid;
 
     size = mQueue.size(); // debugging
 
@@ -230,10 +229,10 @@ void SimpleWorkQueuePriv::execute()
 {
    while (!mInitialized)
    {
-	  mLogger(Debug) << "SimpleWorkQueue::Execute: Waiting for initialization. Queue ID:" << mQid;
+      mLogger(Debug) << "SimpleWorkQueue::Execute: Waiting for initialization. Queue ID:" << mQid;
 
       // The thread can start before the constructor has finished initializing the object.
-	  // Can lead to strange behavior. 
+      // Can lead to strange behavior. 
       continue;
    }
 
@@ -254,11 +253,11 @@ void SimpleWorkQueuePriv::execute()
             }
         } // end lock scope
 
-	   mLogger(Debug) << "SimpleWorkQueue::Execute: Pinging the work queue. Queue ID:" << mQid;
+       mLogger(Debug) << "SimpleWorkQueue::Execute: Pinging the work queue. Queue ID:" << mQid;
 
        shared_ptr<WorkQueue::Work> work  = waitAndDequeue();
 
-	   mLogger(Debug) << "SimpleWorkQueue::Execute: Doing the work. Queue ID:" << mQid;
+       mLogger(Debug) << "SimpleWorkQueue::Execute: Doing the work. Queue ID:" << mQid;
 
        try
        {

commit efccdcd2fddb93ade864340a1419b844f1c9decd
Merge: dda79d3 50f6599
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Dec 22 18:21:53 2010 -0600

    Merge branch 'route_async' of git.asterisk.org:team/ken.hunt/route_async_routing into route_async


commit dda79d3a59752b5368a0a18ba7263fee22982e30
Merge: 4a97865 a0aae3b
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Dec 22 17:29:29 2010 -0600

    Merged conflicts in src/SessionRouter.cpp

diff --cc src/SessionRouter.cpp
index b50b711,18ba7e7..8b0282a
--- a/src/SessionRouter.cpp
+++ b/src/SessionRouter.cpp
@@@ -505,15 -637,10 +637,16 @@@ protected: // These protected operation
  
                  // Create a session on the destination.
                  lg(Debug) << "createSessionForEndpoints(): Creating a session at destination " << destination;
-                 SessionPrx destSession = sessionEndpoint->createSession(destination, listener->getProxy());
+                 SessionPrx destSession = sessionEndpoint->createSession(destination, mListenerManager->getListener()->getProxy());
 +                if(!destSession)
 +                {
 +                    lg(Debug) << " Session endpoint returned a null proxy, continuing with other endpoints";
 +                    continue;
 +                }
++
                  lg(Debug) << "  Session proxy: " << destSession->ice_toString() ;
  
-                 listener->addSession(destSession);
+                 mListenerManager->getListener()->addSession(destSession);
                  newSessions.push_back(destSession);
              }
              catch(const Ice::Exception &exception)

commit 4a97865504713362dbb8ffbfc312c902f6772fcf
Author: Brent Eagles <beagles at digium.com>
Date:   Fri Dec 17 12:49:13 2010 -0330

    * Add some placeholder methods to support changes to the BridgeManager interface.
    
    * Add a check for null proxies from SessionEndpoint::createSession() calls.  This
      modification alone may not be sufficient to deal with the situation that uncovered this
      issue. The routing service needs to verify in all cases that the number of
      successfully created sessions is sufficient to continue.

diff --git a/src/SessionRouter.cpp b/src/SessionRouter.cpp
index 26b54ad..b50b711 100644
--- a/src/SessionRouter.cpp
+++ b/src/SessionRouter.cpp
@@ -506,6 +506,11 @@ public:
                 // Create a session on the destination.
                 lg(Debug) << "createSessionForEndpoints(): Creating a session at destination " << destination;
                 SessionPrx destSession = sessionEndpoint->createSession(destination, listener->getProxy());
+                if(!destSession)
+                {
+                    lg(Debug) << " Session endpoint returned a null proxy, continuing with other endpoints";
+                    continue;
+                }
                 lg(Debug) << "  Session proxy: " << destSession->ice_toString() ;
 
                 listener->addSession(destSession);
diff --git a/test/MockBridgeManager.cpp b/test/MockBridgeManager.cpp
index ae957c0..2210c31 100644
--- a/test/MockBridgeManager.cpp
+++ b/test/MockBridgeManager.cpp
@@ -46,6 +46,14 @@ void MockBridgeManager::removeListener(const BridgeManagerListenerPrx&, const Ic
 {
 }
 
+void MockBridgeManager::addDefaultBridgeListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx&, const Ice::Current&)
+{
+}
+
+void MockBridgeManager::removeDefaultBridgeListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx&, const Ice::Current&)
+{
+}
+
 BridgeSeq MockBridgeManager::listBridges(const Ice::Current&)
 {
     return mBridges;
diff --git a/test/MockBridgeManager.h b/test/MockBridgeManager.h
index 2c98c36..7c25c73 100644
--- a/test/MockBridgeManager.h
+++ b/test/MockBridgeManager.h
@@ -33,6 +33,9 @@ public:
     void addListener(const AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx&, const Ice::Current&);
     AsteriskSCF::SessionCommunications::V1::BridgePrx createBridge(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener, const Ice::Current&);
     void removeListener(const AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx&, const Ice::Current&);
+    void addDefaultBridgeListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx&, const Ice::Current&);
+    void removeDefaultBridgeListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx&, const Ice::Current&);
+
     AsteriskSCF::SessionCommunications::V1::BridgeSeq listBridges(const Ice::Current&);
     void shutdown(const ::Ice::Current&);
 

commit 98cdbcf16080b782965b54c9c45df06ac51249c2
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Dec 14 10:19:36 2010 -0600

    Disambiguate use of 0 as int or char const *.

diff --git a/slice b/slice
index 71b02b7..bdfc399 160000
--- a/slice
+++ b/slice
@@ -1 +1 @@
-Subproject commit 71b02b7071eab51d417f059566dc4aef1ebc2f2f
+Subproject commit bdfc399d5876152d46be8b47cd4122abca1d2ed3
diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index f4c2687..9ba8016 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -70,7 +70,7 @@ void RoutingServiceTest::start(std::string const &name,
         argv.push_back(i->c_str());
     }
     // null terminated list
-    argv.push_back(0);
+    argv.push_back((char const *) 0);
 
     mCachedArgs.argc = argv.size() - 1;
     mCachedArgs.argv = (char**)&argv[0];

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


-- 
team/ken.hunt/route_async_routing.git



More information about the asterisk-scf-commits mailing list