[asterisk-scf-commits] asterisk-scf/release/bridging.git branch "default_bridge_listeners" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Dec 14 07:03:56 CST 2010
branch "default_bridge_listeners" has been updated
via 7217177458385d171fb65223e897d553be66866c (commit)
via 47bd446dc50583253b742c193170158df2bdaa08 (commit)
from 3196083a473be1645896fa18c8ea806957eb10ce (commit)
Summary of changes:
src/BridgeImpl.cpp | 112 +++++++++++++++++++++++++++++----------------
src/BridgeManagerImpl.cpp | 59 ++++++++++++++++-------
src/BridgeServiceConfig.h | 9 +---
test/TestBridging.cpp | 45 ++++++++++--------
4 files changed, 140 insertions(+), 85 deletions(-)
- Log -----------------------------------------------------------------
commit 7217177458385d171fb65223e897d553be66866c
Author: Brent Eagles <beagles at digium.com>
Date: Tue Dec 14 09:32:36 2010 -0330
Simplifying construction when vectors are complete copies and tidying up
some operator logic in a functor template.
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index e8a184a..a6d6666 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -95,7 +95,7 @@ AsteriskSCF::SessionCommunications::V1::BridgePrx AsteriskSCF::BridgeService::Br
AsteriskSCF::SessionCommunications::V1::BridgePrx prx(
AsteriskSCF::SessionCommunications::V1::BridgePrx::uncheckedCast(mAdapter->createProxy(id)));
AsteriskSCF::BridgeService::BridgeListenerMgrPtr mgr(new BridgeListenerMgr(mAdapter->getCommunicator(), stringId, prx));
- std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx> listeners(mDefaultBridgeListeners.begin(), mDefaultBridgeListeners.end());
+ std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx> listeners(mDefaultBridgeListeners);
if(listener)
{
listeners.push_back(listener);
diff --git a/src/BridgeServiceConfig.h b/src/BridgeServiceConfig.h
index 579ad56..289892a 100644
--- a/src/BridgeServiceConfig.h
+++ b/src/BridgeServiceConfig.h
@@ -50,14 +50,7 @@ public:
{
if(toTest == 0)
{
- if(mExample == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
+ return (mExample == 0);
}
if(mExample == 0)
{
commit 47bd446dc50583253b742c193170158df2bdaa08
Author: Brent Eagles <beagles at digium.com>
Date: Fri Dec 10 21:07:39 2010 -0330
Address review feedback:
- add missing exception from statePreCheck
- fix copy construction of a vector
- shorten some line lengths.
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index a37ba7b..480391f 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -72,7 +72,8 @@ void checkSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq& ses
{
Ice::LongSeq invalidIndexes;
Ice::Long index = 0;
- for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = sessions.begin(); i != sessions.end(); ++i, ++index)
+ for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = sessions.begin();
+ i != sessions.end(); ++i, ++index)
{
if(*i == 0)
{
@@ -391,7 +392,8 @@ public:
{
}
- void progressing(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source, const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response, const Ice::Current&)
+ void progressing(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source,
+ const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response, const Ice::Current&)
{
}
@@ -404,7 +406,8 @@ public:
}
}
- void stopped(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source, const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response, const Ice::Current& current)
+ void stopped(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source,
+ const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response, const Ice::Current& current)
{
size_t endpointCount = mBridge->sessionStopped(source, response);
if(endpointCount < 2)
@@ -425,7 +428,8 @@ private:
} // End of namespace AsteriskSCF
AsteriskSCF::BridgeService::BridgeImpl::BridgeImpl(const Ice::ObjectAdapterPtr& adapter,
- const std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx>& listeners, const AsteriskSCF::BridgeService::BridgeListenerMgrPtr& listenerMgr,
+ const std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx>& listeners,
+ const AsteriskSCF::BridgeService::BridgeListenerMgrPtr& listenerMgr,
const AsteriskSCF::SessionCommunications::V1::BridgePrx& prx) :
mState(Running),
mObjAdapter(adapter),
@@ -433,7 +437,8 @@ AsteriskSCF::BridgeService::BridgeImpl::BridgeImpl(const Ice::ObjectAdapterPtr&
mSessionListener(new SessionListener(this)),
mPrx(prx)
{
- for(std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx>::const_iterator i = listeners.begin(); i != listeners.end(); ++i)
+ for(std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx>::const_iterator i = listeners.begin();
+ i != listeners.end(); ++i)
{
mListeners->addListener(*i);
}
@@ -454,7 +459,8 @@ AsteriskSCF::BridgeService::BridgeImpl::~BridgeImpl()
//
}
-void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeImpl::addSessions(
+ const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
{
if(sessions.size() == 0)
{
@@ -465,7 +471,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::Sess
{
boost::unique_lock<boost::shared_mutex> lock(mLock);
statePreCheck();
- lg(Debug) << __FUNCTION__ << ": adding " << sessions.size() << " sessions to " << current.adapter->getCommunicator()->identityToString(current.id);
+ lg(Debug) << __FUNCTION__ << ": adding " << sessions.size() << " sessions to "
+ << current.adapter->getCommunicator()->identityToString(current.id);
for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = sessions.begin();
i != sessions.end(); ++i)
{
@@ -474,10 +481,12 @@ void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::Sess
// impossible to guard against race conditions where multiple call paths might want to add a session
// more than once for some reason. We should probably just log it and move on.
//
- std::vector<BridgeSessionPtr>::iterator j = find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(*i));
+ std::vector<BridgeSessionPtr>::iterator j =
+ find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(*i));
if(j != mSessions.end())
{
- lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() << " is already registered with this bridge.";
+ lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString()
+ << " is already registered with this bridge.";
continue;
}
@@ -507,19 +516,22 @@ void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::Sess
}
catch(const Ice::Exception& ex)
{
- lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() << " threw " << ex.what() << " continuing";
+ lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() << " threw " << ex.what()
+ << " continuing";
}
//
// We need to define these states! Especially the ones that define when start is called or not.
//
if(info->currentState == "ready")
{
- lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() << " current state is ready (not yet connected), not establishing media connections.";
+ lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString()
+ << " current state is ready (not yet connected), not establishing media connections.";
mSessions.push_back(new BridgeSession(*i, 0, false));
}
else
{
- lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() << " media is expected to be establishing, plugging media into bridge.";
+ lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString()
+ << " media is expected to be establishing, plugging media into bridge.";
mSessions.push_back(new BridgeSession(*i, mSplicer.connect(*i), false));;
}
@@ -532,7 +544,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::Sess
}
}
-void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(
+ const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
{
if(sessions.size() == 0)
{
@@ -543,9 +556,11 @@ void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::S
{
boost::unique_lock<boost::shared_mutex> lock(mLock);
statePreCheck();
- for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = sessions.begin(); i != sessions.end(); ++i)
+ for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = sessions.begin();
+ i != sessions.end(); ++i)
{
- std::vector<BridgeSessionPtr>::iterator j = std::find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(*i));
+ std::vector<BridgeSessionPtr>::iterator j = std::find_if(mSessions.begin(),
+ mSessions.end(), AsteriskSCF::BridgeService::FindImpl(*i));
if(j != mSessions.end())
{
try
@@ -554,7 +569,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::S
}
catch(const Ice::Exception& ex)
{
- lg(Info) << __FUNCTION__ << ": removingthe bridge from " << (*j)->getSession() << " threw " << ex.what();
+ lg(Info) << __FUNCTION__ << ": removingthe bridge from " << (*j)->getSession() << " threw "
+ << ex.what();
}
(*j)->disconnect();
mSessions.erase(j);
@@ -563,9 +579,11 @@ void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::S
else
{
//
- // TODO: how do we want to handle sessions that aren't there. Its pretty much impossible to guard against race conditions where
- // an expected session may no longer be present (device hung up, etc). In other words, this should probably be expected and maybe
- // just logged.
+ // TODO: how do we want to handle sessions that aren't there.
+ // Its pretty much impossible to guard against race conditions
+ // where an expected session may no longer be present (device
+ // hung up, etc). In other words, this should probably be
+ // expected and maybe just logged.
//
}
}
@@ -584,14 +602,16 @@ void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::S
}
}
-AsteriskSCF::SessionCommunications::V1::SessionSeq AsteriskSCF::BridgeService::BridgeImpl::listSessions(const Ice::Current& current)
+AsteriskSCF::SessionCommunications::V1::SessionSeq AsteriskSCF::BridgeService::BridgeImpl::listSessions(
+ const Ice::Current& current)
{
lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
boost::shared_lock<boost::shared_mutex> lock(mLock);
statePreCheck();
lg(Debug) << __FUNCTION__ << ": working with " << mSessions.size() << " sessions." ;
AsteriskSCF::SessionCommunications::V1::SessionSeq result;
- for(std::vector<AsteriskSCF::BridgeService::BridgeImpl::BridgeSessionPtr>::const_iterator i = mSessions.begin(); i != mSessions.end(); ++i)
+ for(std::vector<AsteriskSCF::BridgeService::BridgeImpl::BridgeSessionPtr>::const_iterator i = mSessions.begin(); i != mSessions.end();
+ ++i)
{
result.push_back((*i)->getSession());
}
@@ -626,7 +646,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::shutdown(const Ice::Current& curren
if(mSessions.size() > 0)
{
std::for_each(mSessions.begin(), mSessions.end(),
- AsteriskSCF::BridgeService::ShutdownImpl(mSessionListenerPrx, new AsteriskSCF::SessionCommunications::V1::ResponseCode));
+ AsteriskSCF::BridgeService::ShutdownImpl(mSessionListenerPrx,
+ new AsteriskSCF::SessionCommunications::V1::ResponseCode));
}
lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": is shutdown." ;
@@ -671,20 +692,24 @@ void AsteriskSCF::BridgeService::BridgeImpl::destroy(const Ice::Current& current
//
}
-void AsteriskSCF::BridgeService::BridgeImpl::addListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
- const Ice::Current&)
+void AsteriskSCF::BridgeService::BridgeImpl::addListener(
+ const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
+ const Ice::Current&)
{
mListeners->addListener(listener);
}
-void AsteriskSCF::BridgeService::BridgeImpl::removeListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
+void AsteriskSCF::BridgeService::BridgeImpl::removeListener(
+ const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
const Ice::Current&)
{
mListeners->removeListener(listener);
}
-void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::SessionCommunications::V1::SessionPrx& oldSession,
- const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(
+ const AsteriskSCF::SessionCommunications::V1::SessionPrx& oldSession,
+ const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions,
+ const Ice::Current& current)
{
lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
BridgeSessionPtr toRemove;
@@ -698,7 +723,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::S
boost::unique_lock<boost::shared_mutex> lock(mLock);
statePreCheck();
- std::vector<BridgeSessionPtr>::iterator i = find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(oldSession));
+ std::vector<BridgeSessionPtr>::iterator i =
+ find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(oldSession));
//
// We need to disconnect the media while the bridge is locked because the media splicer does not currently
@@ -712,11 +738,13 @@ void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::S
mSessions.erase(i);
}
//
- // We don't do anything else with the new members just yet. We are going to release the lock and continue with things.
+ // We don't do anything else with the new members just yet. We are
+ // going to release the lock and continue with things.
//
}
std::vector<AsteriskSCF::SessionCommunications::V1::SessionInfoPtr> infoSeq;
- for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = newSessions.begin(); i != newSessions.end(); ++i)
+ for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = newSessions.begin();
+ i != newSessions.end(); ++i)
{
try
{
@@ -768,8 +796,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::S
}
//
- // The call on the session to disassociate it from the bridge is deferred until after the lock on the bridge has
- // been released.
+ // The call on the session to disassociate it from the bridge is deferred
+ // until after the lock on the bridge has been released.
//
if(toRemove)
{
@@ -787,7 +815,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::S
}
catch(const AsteriskSCF::SessionCommunications::V1::NotBridged&)
{
- lg(Info) << __FUNCTION__ << ": removeBridge on session being replaced threw a `NotBridged' exception";
+ lg(Info) << __FUNCTION__ <<
+ ": removeBridge on session being replaced threw a `NotBridged' exception";
break;
}
catch(const Ice::ConnectionLostException&)
@@ -837,11 +866,13 @@ void AsteriskSCF::BridgeService::BridgeImpl::destroyImpl()
}
}
-void AsteriskSCF::BridgeService::BridgeImpl::sessionConnected(const AsteriskSCF::SessionCommunications::V1::SessionPrx& session)
+void AsteriskSCF::BridgeService::BridgeImpl::sessionConnected(
+ const AsteriskSCF::SessionCommunications::V1::SessionPrx& session)
{
lg(Debug) << __FUNCTION__ << ": session connected " << session->ice_toString() ;
boost::unique_lock<boost::shared_mutex> lock(mLock);
- std::vector<BridgeSessionPtr>::iterator i = find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(session));
+ std::vector<BridgeSessionPtr>::iterator i =
+ find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(session));
#ifndef _NDEBUG
if(i == mSessions.end())
{
@@ -855,8 +886,9 @@ void AsteriskSCF::BridgeService::BridgeImpl::sessionConnected(const AsteriskSCF:
}
}
-size_t AsteriskSCF::BridgeService::BridgeImpl::sessionStopped(const AsteriskSCF::SessionCommunications::V1::SessionPrx& session,
- const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response)
+size_t AsteriskSCF::BridgeService::BridgeImpl::sessionStopped(
+ const AsteriskSCF::SessionCommunications::V1::SessionPrx& session,
+ const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response)
{
lg(Debug) << __FUNCTION__ << ": session terminated from " << session->ice_toString() ;
try
@@ -877,7 +909,8 @@ size_t AsteriskSCF::BridgeService::BridgeImpl::sessionStopped(const AsteriskSCF:
size_t sizeAfter;
{
boost::unique_lock<boost::shared_mutex> lock(mLock);
- std::vector<BridgeSessionPtr>::iterator i = find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(session));
+ std::vector<BridgeSessionPtr>::iterator i =
+ find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(session));
if(i != mSessions.end())
{
b = *i;
@@ -942,7 +975,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::spawnShutdown()
}
}
-std::vector<AsteriskSCF::BridgeService::BridgeImpl::BridgeSessionPtr> AsteriskSCF::BridgeService::BridgeImpl::currentSessions()
+std::vector<AsteriskSCF::BridgeService::BridgeImpl::BridgeSessionPtr>
+AsteriskSCF::BridgeService::BridgeImpl::currentSessions()
{
boost::shared_lock<boost::shared_mutex> lock(mLock);
return mSessions;
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index e8a0242..e8a184a 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -56,8 +56,9 @@ private:
} // End of namespace BridgeService
} // End of namespace AsteriskSCF
-AsteriskSCF::BridgeService::BridgeManagerImpl::BridgeManagerImpl(const Ice::ObjectAdapterPtr& adapter, const std::string& name,
- const AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx& prx, const AsteriskSCF::System::Logging::LoggerPtr& logger) :
+AsteriskSCF::BridgeService::BridgeManagerImpl::BridgeManagerImpl(const Ice::ObjectAdapterPtr& adapter,
+ const std::string& name, const AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx& prx,
+ const AsteriskSCF::System::Logging::LoggerPtr& logger) :
mName(name),
mShuttingDown(false),
mSuspended(false),
@@ -66,12 +67,13 @@ AsteriskSCF::BridgeService::BridgeManagerImpl::BridgeManagerImpl(const Ice::Obje
mLogger(logger)
{
mLogger(Info) << "Created AsteriskSCF Session-Oriented Bridge Manager." ;
- mListeners = new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(mAdapter->getCommunicator(), mName, mSourceProxy);
+ mListeners =
+ new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(mAdapter->getCommunicator(), mName, mSourceProxy);
}
AsteriskSCF::BridgeService::BridgeManagerImpl::~BridgeManagerImpl()
{
- if(mListeners)
+ if (mListeners)
{
mListeners->stop();
}
@@ -119,38 +121,47 @@ AsteriskSCF::SessionCommunications::V1::BridgePrx AsteriskSCF::BridgeService::Br
return info.proxy;
}
-void AsteriskSCF::BridgeService::BridgeManagerImpl::addListener(const SessionCommunications::V1::BridgeManagerListenerPrx& listener, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeManagerImpl::addListener(
+ const SessionCommunications::V1::BridgeManagerListenerPrx& listener, const Ice::Current& current)
{
mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
boost::unique_lock<boost::shared_mutex> lock(mLock);
statePreCheck(__FUNCTION__);
if(!mListeners)
{
- mSourceProxy = AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::uncheckedCast(mAdapter->createProxy(current.id));
- mListeners = new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(mAdapter->getCommunicator(), mName, mSourceProxy);
+ mSourceProxy =
+ AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::uncheckedCast(
+ mAdapter->createProxy(current.id));
+ mListeners = new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(mAdapter->getCommunicator(),
+ mName, mSourceProxy);
}
mListeners->addListener(listener);
}
-void AsteriskSCF::BridgeService::BridgeManagerImpl::removeListener(const SessionCommunications::V1::BridgeManagerListenerPrx& listener, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeManagerImpl::removeListener(
+ const SessionCommunications::V1::BridgeManagerListenerPrx& listener, const Ice::Current& current)
{
mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
boost::unique_lock<boost::shared_mutex> lock(mLock);
statePreCheck(__FUNCTION__);
if(!mListeners)
{
- mSourceProxy = AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::uncheckedCast(mAdapter->createProxy(current.id));
- mListeners = new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(mAdapter->getCommunicator(), mName, mSourceProxy);
+ mSourceProxy = AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::uncheckedCast(
+ mAdapter->createProxy(current.id));
+ mListeners = new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(
+ mAdapter->getCommunicator(), mName, mSourceProxy);
}
mListeners->removeListener(listener);
}
-void AsteriskSCF::BridgeService::BridgeManagerImpl::addDefaultBridgeListener(const SessionCommunications::V1::BridgeListenerPrx& newListener, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeManagerImpl::addDefaultBridgeListener(
+ const SessionCommunications::V1::BridgeListenerPrx& newListener, const Ice::Current& current)
{
mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
if(!newListener)
{
- mLogger(Info) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) << " attempting to add a null proxy";
+ mLogger(Info) << __FUNCTION__ << ":" <<
+ current.adapter->getCommunicator()->identityToString(current.id) << " attempting to add a null proxy";
throw AsteriskSCF::SessionCommunications::V1::NullProxyException();
}
boost::shared_lock<boost::shared_mutex> lock(mLock);
@@ -163,17 +174,20 @@ void AsteriskSCF::BridgeService::BridgeManagerImpl::addDefaultBridgeListener(con
}
-void AsteriskSCF::BridgeService::BridgeManagerImpl::removeDefaultBridgeListener(const SessionCommunications::V1::BridgeListenerPrx& toRemove, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeManagerImpl::removeDefaultBridgeListener(
+ const SessionCommunications::V1::BridgeListenerPrx& toRemove, const Ice::Current& current)
{
mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
if(!toRemove)
{
- mLogger(Info) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) << " attempting to remove a null proxy";
+ mLogger(Info) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id)
+ << " attempting to remove a null proxy";
throw AsteriskSCF::SessionCommunications::V1::NullProxyException();
}
boost::shared_lock<boost::shared_mutex> lock(mLock);
statePreCheck(__FUNCTION__);
- std::remove_if(mDefaultBridgeListeners.begin(), mDefaultBridgeListeners.end(), IdentityComparePred<SessionCommunications::V1::BridgeListenerPrx>(toRemove));
+ std::remove_if(mDefaultBridgeListeners.begin(), mDefaultBridgeListeners.end(),
+ IdentityComparePred<SessionCommunications::V1::BridgeListenerPrx>(toRemove));
}
AsteriskSCF::SessionCommunications::V1::BridgeSeq
@@ -193,7 +207,16 @@ void AsteriskSCF::BridgeService::BridgeManagerImpl::shutdown(const Ice::Current&
{
mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
boost::unique_lock<boost::shared_mutex> lock(mLock);
- statePreCheck(__FUNCTION__);
+ if(mShuttingDown)
+ {
+ mLogger(Debug) << __FUNCTION__ << ": already shutting down.";
+ return;
+ }
+ if(mSuspended || mListeners->isSuspended())
+ {
+ mLogger(Debug) << __FUNCTION__ << ": called when suspended." ;
+ throw AsteriskSCF::System::Component::V1::Suspended();
+ }
if(mListeners && !mListeners->isSuspended())
{
mListeners->stopping();
@@ -236,7 +259,7 @@ void AsteriskSCF::BridgeService::BridgeManagerImpl::statePreCheck(const std::str
if(mShuttingDown)
{
mLogger(Debug) << caller << ": called when shutting down." ;
- return;
+ throw AsteriskSCF::System::Component::V1::ShuttingDown();
}
if(mSuspended || mListeners->isSuspended())
{
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index ddeee26..5cf03e7 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -262,17 +262,18 @@ public:
}
catch(const Ice::Exception& ex)
{
- std::cerr << ex << std::endl;
- BOOST_CHECK(false);
+ std::ostringstream msg;
+ msg << "Unexpected Ice exception " << ex.what();
+ BOOST_FAIL(msg.str());
}
catch(...)
{
- BOOST_CHECK(false);
+ BOOST_FAIL("Unexpected exception");
}
}
catch(...)
{
- BOOST_CHECK(false);
+ BOOST_FAIL("Unexpected exception");
}
};
@@ -347,17 +348,18 @@ public:
}
catch(const Ice::Exception& ex)
{
- std::cerr << ex << std::endl;
- BOOST_CHECK(false);
+ std::ostringstream msg;
+ msg << "Unexpected Ice exception " << ex.what();
+ BOOST_FAIL(msg.str());
}
catch(...)
{
- BOOST_CHECK(false);
+ BOOST_FAIL("Unexpected exception");
}
}
catch(...)
{
- BOOST_CHECK(false);
+ BOOST_FAIL("Unexpected exception");
}
};
@@ -440,17 +442,18 @@ public:
}
catch(const Ice::Exception& ex)
{
- std::cerr << ex << std::endl;
- BOOST_CHECK(false);
+ std::ostringstream msg;
+ msg << "Unexpected Ice exception " << ex.what();
+ BOOST_FAIL(msg.str());
}
catch(...)
{
- BOOST_CHECK(false);
+ BOOST_FAIL("Unexpected exception");
}
}
catch(...)
{
- BOOST_CHECK(false);
+ BOOST_FAIL("Unexpected exception");
}
};
@@ -491,17 +494,18 @@ public:
}
catch(const Ice::Exception& ex)
{
- std::cerr << ex << std::endl;
- BOOST_CHECK(false);
+ std::ostringstream msg;
+ msg << "Unexpected Ice exception " << ex.what();
+ BOOST_FAIL(msg.str());
}
catch(...)
{
- BOOST_CHECK(false);
+ BOOST_FAIL("Unexpected exception");
}
}
catch(...)
{
- BOOST_CHECK(false);
+ BOOST_FAIL("Unexpected exception");
}
};
@@ -563,17 +567,18 @@ public:
}
catch(const Ice::Exception& ex)
{
- std::cerr << ex << std::endl;
- BOOST_CHECK(false);
+ std::ostringstream msg;
+ msg << "Unexpected Ice exception " << ex.what();
+ BOOST_FAIL(msg.str());
}
catch(...)
{
- BOOST_CHECK(false);
+ BOOST_FAIL("Unexpected exception");
}
}
catch(...)
{
- BOOST_CHECK(false);
+ BOOST_FAIL("Unexpected exception");
}
}
-----------------------------------------------------------------------
--
asterisk-scf/release/bridging.git
More information about the asterisk-scf-commits
mailing list