[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "retry_deux" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri May 4 10:58:20 CDT 2012


branch "retry_deux" has been updated
       via  9b590e90b3fe39ecb93f46e84b1145ee48da031d (commit)
      from  f4427af1821000f5b16750ad67fc66ca9e45c915 (commit)

Summary of changes:
 src/BridgeImpl.cpp        |   44 ++++++++++++++++++++++----------------------
 src/BridgeManagerImpl.cpp |    8 ++++----
 src/MediaSplicer.cpp      |   17 +++++++++--------
 src/SessionListener.cpp   |    2 +-
 src/SessionOperations.cpp |   13 +++++++------
 src/SessionWrapper.cpp    |    7 ++++---
 6 files changed, 47 insertions(+), 44 deletions(-)


- Log -----------------------------------------------------------------
commit 9b590e90b3fe39ecb93f46e84b1145ee48da031d
Author: Brent Eagles <beagles at digium.com>
Date:   Fri May 4 13:20:32 2012 -0230

    Incorporate review feedback:
     - remove unnecessary static keywords
     - employ operation context helper in ice-util-cpp.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index bf715cf..ae578b4 100644
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -289,7 +289,7 @@ typedef IceUtil::Handle<BridgeImpl> BridgeImplPtr;
 //
 // Simply checks for nulls at this point.
 //
-static void checkSessions(const SessionSeq& sessions)
+void checkSessions(const SessionSeq& sessions)
 {
     Ice::LongSeq invalidIndexes;
     Ice::Long index = 0;
@@ -428,7 +428,7 @@ protected:
             
             // Forward the info via the SessionController for this session.
             sessionController->updateRedirections(
-                addContextSuffix(mRootContext, identityToString(sessionController->ice_getIdentity())),
+                calculateOperationContext(mRootContext, identityToString(sessionController->ice_getIdentity())),
                 currentRedirections);
         }
     }
@@ -563,7 +563,7 @@ protected:
         if (sessionController)
         {
             // Forward the info via the SessionController for this session.
-            sessionController->updateConnectedLine(addContextSuffix(mRootContext, identityToString(sessionController->ice_getIdentity())),
+            sessionController->updateConnectedLine(calculateOperationContext(mRootContext, identityToString(sessionController->ice_getIdentity())),
                 currentConnectedLine);
         }
     }
@@ -678,7 +678,7 @@ protected:
         if (sessionController)
         {
             sessionController->updateCallerID(
-                addContextSuffix(mRootContext, identityToString(sessionController->ice_getIdentity())),
+                calculateOperationContext(mRootContext, identityToString(sessionController->ice_getIdentity())),
                     currentCallerID);
         }
     }
@@ -864,7 +864,7 @@ protected:
                 continue;
             }
             tasksDispatched = true;
-            (*i)->begin_setBridge(addContextSuffix(mRootContext, identityToString(mBridge->ice_getIdentity())), mBridge,
+            (*i)->begin_setBridge(calculateOperationContext(mRootContext, identityToString(mBridge->ice_getIdentity())), mBridge,
                 mSessionListener, newCallback_Session_setBridge(this, &SetBridgeTask::set,
                     &SetBridgeTask::failed), session);
         }
@@ -1136,7 +1136,7 @@ protected:
                 SessionControllerPrx::uncheckedCast(mAdapter->add(controller, mAdapter->getCommunicator()->stringToIdentity(identity)));
             
             (*i)->begin_setAndGetSessionController(
-                addContextSuffix(mRootContext, identityToString((*i)->ice_getIdentity())), 
+                calculateOperationContext(mRootContext, identityToString((*i)->ice_getIdentity())), 
                 controllerPrx, 
                 newCallback_Session_setAndGetSessionController(this, &SetAndGetSessionControllerTask::get, 
                     &SetAndGetSessionControllerTask::failed), session);
@@ -1237,7 +1237,7 @@ protected:
             // Remove the session controller from the session itself
             SessionControllerPrx controller = SessionControllerPrx::uncheckedCast(mAdapter->createProxy(
                     mAdapter->getCommunicator()->stringToIdentity(identity)));
-            (*i)->removeSessionController(addContextSuffix(mRootContext, identity), controller);
+            (*i)->removeSessionController(calculateOperationContext(mRootContext, identity), controller);
         }
         return true;
     }
@@ -1574,7 +1574,7 @@ protected:
         for(TelephonyEventSourceSeq::iterator i=fromSources.begin();   
             i != fromSources.end(); ++i)
         {
-            (*i)->removeSinks(addContextSuffix(mRootContext, identityToString((*i)->ice_getIdentity())),
+            (*i)->removeSinks(calculateOperationContext(mRootContext, identityToString((*i)->ice_getIdentity())),
                 sinksToRemove);
         }
     }
@@ -1713,7 +1713,7 @@ void BridgeImpl::updateRedirections(const SessionWrapperPtr& sourceSession,
     }
 }
 
-static SessionPrx extractSession(const SessionWithSessionInfo& swsi)
+SessionPrx extractSession(const SessionWithSessionInfo& swsi)
 {
     return swsi.sessionProxy;
 }
@@ -1952,7 +1952,7 @@ void BridgeImpl::shutdown(const AsteriskSCF::System::V1::OperationContextPtr& op
                 {
                     Ice::StringSeq keys;
                     keys.push_back(mState->key);
-                    mReplicator->removeState(addContextSuffix(operationContext, mName), keys);
+                    mReplicator->removeState(calculateOperationContext(operationContext, mName), keys);
                 }
             }
             catch (const Ice::Exception&)
@@ -2026,7 +2026,7 @@ void BridgeImpl::destroy(const AsteriskSCF::System::V1::OperationContextPtr& con
         {
             Ice::StringSeq keys;
             keys.push_back(mState->key);
-            mReplicator->removeState(addContextSuffix(context, mName), keys);
+            mReplicator->removeState(calculateOperationContext(context, mName), keys);
         }
     }
     catch (const Ice::Exception&)
@@ -2059,7 +2059,7 @@ void BridgeImpl::addListener(const AsteriskSCF::System::V1::OperationContextPtr&
             {
                 ReplicatedStateItemSeq seq;
                 seq.push_back(createFirstListenerUpdate(listener));
-                mReplicator->setState(addContextSuffix(operationContext, mName + ".addListener"), seq);
+                mReplicator->setState(calculateOperationContext(operationContext, mName + ".addListener"), seq);
             }
             data->getMonitor()->setCompleted();
         }
@@ -2118,7 +2118,7 @@ void BridgeImpl::removeListener(const AsteriskSCF::System::V1::OperationContextP
                     {
                         Ice::StringSeq keys;
                         keys.push_back(key);
-                        mReplicator->removeState(addContextSuffix(operationContext, mName + ".removeListener"), keys);
+                        mReplicator->removeState(calculateOperationContext(operationContext, mName + ".removeListener"), keys);
                     }
                     catch (const std::exception& ex)
                     {
@@ -2530,43 +2530,43 @@ void BridgeImpl::getAddSessionsTasks(QueuedTasks& tasks,
     //
     // FAILOVER: You don't want this to happen after failover.
     //
-    tasks.push_back(new UnplugMedia(addContextSuffix(context, ".UnplugMedia"), this));
+    tasks.push_back(new UnplugMedia(calculateOperationContext(context, ".UnplugMedia"), this));
     //
     // FAILOVER: This probably isn't so bad.
     //
-    tasks.push_back(new SetBridgeTask(addContextSuffix(context, ".SetBridgeTask"),
+    tasks.push_back(new SetBridgeTask(calculateOperationContext(context, ".SetBridgeTask"),
                 mSessions, mPrx, mSessionListenerPrx, sessions, tracker));
     //
     // FAILOVER: Also not so bad as long as duplicates are handled properly.
     //
-    tasks.push_back(new AddToListeners(addContextSuffix(context, ".AddToListeners"), mListeners, tracker, getCookies()));
+    tasks.push_back(new AddToListeners(calculateOperationContext(context, ".AddToListeners"), mListeners, tracker, getCookies()));
     //
     // FAILOVER: This might have side-effects. Might be best not to redo it.
     //
-    tasks.push_back(new SetAndGetSessionControllerTask(addContextSuffix(context, ".SetAndGetSessionController"),
+    tasks.push_back(new SetAndGetSessionControllerTask(calculateOperationContext(context, ".SetAndGetSessionController"),
             mObjAdapter, mSessions, sessions, this, mLogger));
     //
     // FAILOVER: Avoid redoing.
     //
-    tasks.push_back(new ForwardCallerIDTask(addContextSuffix(context, ".ForwardCallerIDTask"), this, source, callerID, mLogger));
+    tasks.push_back(new ForwardCallerIDTask(calculateOperationContext(context, ".ForwardCallerIDTask"), this, source, callerID, mLogger));
     //
     // FAILOVER: Avoid redoing.
     //
-    tasks.push_back(new ForwardRedirectionsUpdatedTask(addContextSuffix(context, ".ForwardRedirectionsUpdateTask"),
+    tasks.push_back(new ForwardRedirectionsUpdatedTask(calculateOperationContext(context, ".ForwardRedirectionsUpdateTask"),
             this, source, redirects, mLogger));
     //
     // FAILOVER: Avoid redoing.
     //
-    tasks.push_back(new SetupMedia(addContextSuffix(context, ".SetupMedia"), this));
+    tasks.push_back(new SetupMedia(calculateOperationContext(context, ".SetupMedia"), this));
     //
     // FAILOVER: Avoid redoing.
     //
-    tasks.push_back(new ConnectTelephonyEventsTask(addContextSuffix(context, ".ConnectTelephonyEventsTask"),
+    tasks.push_back(new ConnectTelephonyEventsTask(calculateOperationContext(context, ".ConnectTelephonyEventsTask"),
             this, sessions, mLogger));
     //
     // FAILOVER: No point in doing this one again.
     //
-    tasks.push_back(new UpdateTask(addContextSuffix(context, ".UpdateTask"), this));
+    tasks.push_back(new UpdateTask(calculateOperationContext(context, ".UpdateTask"), this));
 }
 
 void BridgeImpl::statePreCheck()
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index fad3bec..3eb7a05 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -54,7 +54,7 @@ namespace
 // source file.  I found it distracting to have them at the top of the
 // file.
 //
-static void dump(const Logger& logger, const BridgeCreationHookDataPtr& hookData);
+void dump(const Logger& logger, const BridgeCreationHookDataPtr& hookData);
 
 /**
  * BridgeManagerImpl is the concrete servant implementation for the
@@ -720,7 +720,7 @@ void BridgeManagerImpl::shutdown(const AsteriskSCF::System::V1::OperationContext
                 if (mCreationExtensionPointServicePrx)
                 {
                     mCreationExtensionPointServicePrx->unregister(
-                        addContextSuffix(operationContext, mName + ".shutdown"));
+                        calculateOperationContext(operationContext, mName + ".shutdown"));
                 }
             }
             catch (const std::exception& ex)
@@ -946,7 +946,7 @@ void BridgeManagerImpl::update(const AsteriskSCF::System::V1::OperationContextPt
 // It is far too expensive to risk introduction into release builds.
 //
 #ifndef _NDEBUG
-static void dump(const Logger& logger, const BridgeCreationHookDataPtr& hookData)
+void dump(const Logger& logger, const BridgeCreationHookDataPtr& hookData)
 {
     //
     // TODO: this whole thing should not be run unless things are at the
@@ -976,7 +976,7 @@ static void dump(const Logger& logger, const BridgeCreationHookDataPtr& hookData
     logger(Trace) << os.str();
 }
 #else
-static void dump(const Logger&, const BridgeCreationHookDataPtr&)
+void dump(const Logger&, const BridgeCreationHookDataPtr&)
 {
 }
 #endif
diff --git a/src/MediaSplicer.cpp b/src/MediaSplicer.cpp
index 90431f1..6720176 100644
--- a/src/MediaSplicer.cpp
+++ b/src/MediaSplicer.cpp
@@ -42,6 +42,7 @@ using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::Media::Formats::Audio::V1;
 using namespace AsteriskSCF::Replication::BridgeService::V1;
+using namespace AsteriskSCF::Operations;
 using namespace std;
 
 namespace AsteriskSCF
@@ -267,7 +268,7 @@ public:
         {
             try
             {
-                pairing->first->setSource(addContextSuffix(rootContext, mBridgeId), StreamSourcePrx());
+                pairing->first->setSource(calculateOperationContext(rootContext, mBridgeId), StreamSourcePrx());
             }
             catch (const Ice::Exception& ex)
             {
@@ -281,7 +282,7 @@ public:
         {
             try
             {
-                pairing->first->removeSink(addContextSuffix(rootContext, mBridgeId), pairing->second);
+                pairing->first->removeSink(calculateOperationContext(rootContext, mBridgeId), pairing->second);
             }
             catch (const Ice::Exception& ex)
             {
@@ -337,7 +338,7 @@ public:
         {
             try
             {
-                pairing->first->setSource(addContextSuffix(context, mBridgeId + ".disconnectMedia"), StreamSourcePrx());
+                pairing->first->setSource(calculateOperationContext(context, mBridgeId + ".disconnectMedia"), StreamSourcePrx());
             }
             catch (const Ice::Exception& ex)
             {
@@ -351,7 +352,7 @@ public:
         {
             try
             {
-                pairing->first->removeSink(addContextSuffix(context, mBridgeId + ".disconnectMedia"), pairing->second);
+                pairing->first->removeSink(calculateOperationContext(context, mBridgeId + ".disconnectMedia"), pairing->second);
             }
             catch (const Ice::Exception& ex)
             {
@@ -971,11 +972,11 @@ protected:
         {
             OutgoingHelperPtr h(new OutgoingHelper(this, index));
             i->second->begin_addSink(
-                addContextSuffix(mMaterials->rootContext,
+                calculateOperationContext(mMaterials->rootContext,
                     identityToString(i->second->ice_getIdentity())), 
                 i->first, AsteriskSCF::Media::V1::newCallback_StreamSource_addSink(h, &OutgoingHelper::addSinkCB, &OutgoingHelper::failed));
             i->first->begin_setSource(
-                addContextSuffix(mMaterials->rootContext,
+                calculateOperationContext(mMaterials->rootContext,
                     identityToString(i->first->ice_getIdentity())), 
                 i->second, AsteriskSCF::Media::V1::newCallback_StreamSink_setSource(h, &OutgoingHelper::setSourceCB, &OutgoingHelper::failed));
             ++index;
@@ -985,11 +986,11 @@ protected:
         {
             IncomingHelperPtr h(new IncomingHelper(this, index));
             i->first->begin_addSink(
-                addContextSuffix(mMaterials->rootContext,
+                calculateOperationContext(mMaterials->rootContext,
                     identityToString(i->first->ice_getIdentity())), 
                 i->second,  AsteriskSCF::Media::V1::newCallback_StreamSource_addSink(h, &IncomingHelper::addSinkCB, &IncomingHelper::failed));
             i->second->begin_setSource(
-                addContextSuffix(mMaterials->rootContext,
+                calculateOperationContext(mMaterials->rootContext,
                     identityToString(i->second->ice_getIdentity())), 
                 i->first,  AsteriskSCF::Media::V1::newCallback_StreamSink_setSource(h, &IncomingHelper::setSourceCB, &IncomingHelper::failed));
             ++index;
diff --git a/src/SessionListener.cpp b/src/SessionListener.cpp
index 919c90e..37afe2c 100644
--- a/src/SessionListener.cpp
+++ b/src/SessionListener.cpp
@@ -164,7 +164,7 @@ public:
                             return;
                         }
 
-                        session->setup(addContextSuffix(context, identityToString(mBridgePrx->ice_getIdentity())));
+                        session->setup(calculateOperationContext(context, identityToString(mBridgePrx->ice_getIdentity())));
             
                         ConnectSessionOperation connector(context, source, mLogger);
                         mSessions->visitSessions(connector);
diff --git a/src/SessionOperations.cpp b/src/SessionOperations.cpp
index 0fe6ec4..d93a13e 100644
--- a/src/SessionOperations.cpp
+++ b/src/SessionOperations.cpp
@@ -21,6 +21,7 @@ using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::SessionCommunications::V1;
 using namespace AsteriskSCF::BridgeService;
 using namespace AsteriskSCF::Replication::BridgeService::V1;
+using namespace AsteriskSCF::Operations;
 using namespace AsteriskSCF;
 using namespace std;
 
@@ -95,7 +96,7 @@ void ShutdownSessionOperation::operator()(const SessionWrapperPtr& wrapper)
 {
     if (mSkipExclude || wrapper->getSession()->ice_getIdentity() != mExclude)
     {
-        wrapper->shutdown(addContextSuffix(mRootContext, wrapper->id()), mListener, mResponse);
+        wrapper->shutdown(calculateOperationContext(mRootContext, wrapper->id()), mListener, mResponse);
     }
 }
 
@@ -120,7 +121,7 @@ void RelayIndication::operator()(const SessionWrapperPtr& session)
             //
             // TODO: AMI.. or would this be better as a oneway. Do we care if we get a response etc?
             //
-	    s->indicate(addContextSuffix(mRootContext, session->id()), mIndication);
+	    s->indicate(calculateOperationContext(mRootContext, session->id()), mIndication);
         }
         catch (const Ice::ObjectNotExistException& ex)
         {
@@ -165,7 +166,7 @@ void AddStreamsOperation::operator()(const SessionWrapperPtr& session)
 
     // Go ahead and request that the streams be added
     controller->begin_addStreams(
-        addContextSuffix(mRootContext, session->id()), mStreams,
+        calculateOperationContext(mRootContext, session->id()), mStreams,
         newCallback_SessionController_addStreams(this, &AddStreamsOperation::added, &AddStreamsOperation::failed),
                                  session);
 
@@ -245,7 +246,7 @@ void RemoveStreamsOperation::operator()(const SessionWrapperPtr& session)
         return;
     }
 
-    controller->begin_removeStreams(addContextSuffix(mRootContext, session->id()),
+    controller->begin_removeStreams(calculateOperationContext(mRootContext, session->id()),
         remove, newCallback_SessionController_removeStreams(this, &RemoveStreamsOperation::removed,
             &RemoveStreamsOperation::failed), session);
 
@@ -330,7 +331,7 @@ void ConnectTelephonyOperation::connectSinks(const TelephonySessionPrx& sourceSe
         //
         string idString = id.name + id.category;
         
-        (*i)->addSinks(addContextSuffix(mRootContext, idString), sinksToAdd);
+        (*i)->addSinks(calculateOperationContext(mRootContext, idString), sinksToAdd);
     }
 }
 
@@ -381,7 +382,7 @@ void DisconnectTelephonyOperation::disconnectSinks(const TelephonySessionPrx& so
         //
         string idString = id.name + id.category;
 
-        (*i)->removeSinks(addContextSuffix(mRootContext, idString), sinksToRemove);
+        (*i)->removeSinks(calculateOperationContext(mRootContext, idString), sinksToRemove);
     }
 }
 
diff --git a/src/SessionWrapper.cpp b/src/SessionWrapper.cpp
index a672776..f0d4449 100644
--- a/src/SessionWrapper.cpp
+++ b/src/SessionWrapper.cpp
@@ -27,6 +27,7 @@ using namespace AsteriskSCF::SessionCommunications::V1;
 using namespace AsteriskSCF::SessionCommunications::PartyIdentification::V1;
 using namespace AsteriskSCF::BridgeService;
 using namespace AsteriskSCF::Replication::BridgeService::V1;
+using namespace AsteriskSCF::Operations;
 using namespace AsteriskSCF;
 using namespace std;
 
@@ -182,7 +183,7 @@ protected:
     bool executeImpl()
     {
         mSession->getSession()->begin_stop(
-            addContextSuffix(mRootContext,
+            calculateOperationContext(mRootContext,
                 identityToString(mSession->getSession()->ice_getIdentity()) + ".SessionStopTask"),
             mCode, newCallback_Session_stop(this, &SessionStopTask::removed,
                 &SessionStopTask::failed));
@@ -433,7 +434,7 @@ void SessionWrapper::connect(const AsteriskSCF::System::V1::OperationContextPtr&
         mLogger(Trace) << FUNLOG << " sending ConnectIndication() to " << mId;
 
         mSession->session->begin_indicate(
-            addContextSuffix(rootContext, ".bridgeConnect"),
+            calculateOperationContext(rootContext, ".bridgeConnect"),
 	    new AsteriskSCF::SessionCommunications::V1::ConnectIndication(),
             newCallback_Session_indicate(new ConnectRequestCallback(this, mLogger),
 		&ConnectRequestCallback::connectCB,
@@ -520,7 +521,7 @@ void SessionWrapper::setupMedia(const AsteriskSCF::System::V1::OperationContextP
     //
     // The context already includes bridge specific info, so all is well.
     //
-    mSplicer->connect(addContextSuffix(context, mId), this, mSession->session);
+    mSplicer->connect(calculateOperationContext(context, mId), this, mSession->session);
 }
 
 void SessionWrapper::setConnector(const MediaConnectorPtr& connector)

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


-- 
asterisk-scf/integration/bridging.git



More information about the asterisk-scf-commits mailing list