[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "async-bridging" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Mar 14 11:27:08 CDT 2011
branch "async-bridging" has been updated
via d0f7834cd6374340365048b2d838da1bad18b026 (commit)
from 4ba15a34d409f5d9cac4de90a6da902f74dda3ee (commit)
Summary of changes:
src/BridgeImpl.cpp | 5 ++++-
src/MediaSplicer.cpp | 16 ++++++++--------
src/SessionWrapper.cpp | 17 ++++++++++-------
src/Tasks.h | 8 +++++++-
test/TestBridging.cpp | 31 ++++++++++++++++++++++++++-----
5 files changed, 55 insertions(+), 22 deletions(-)
- Log -----------------------------------------------------------------
commit d0f7834cd6374340365048b2d838da1bad18b026
Author: Brent Eagles <beagles at digium.com>
Date: Mon Mar 14 13:56:19 2011 -0230
Fix some operation ordering bugs introduced in the last commit (the
evaluation order of the task list changed).
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 5861bab..19ccb4f 100644
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -629,7 +629,10 @@ void BridgeImpl::destroyImpl()
mState->runningState = Destroyed;
mSessions = 0;
- mObjAdapter->remove(mPrx->ice_getIdentity());
+ if (mPrx)
+ {
+ mObjAdapter->remove(mPrx->ice_getIdentity());
+ }
}
catch (const Ice::Exception&)
{
diff --git a/src/MediaSplicer.cpp b/src/MediaSplicer.cpp
index 83f9b0b..7fab2b1 100644
--- a/src/MediaSplicer.cpp
+++ b/src/MediaSplicer.cpp
@@ -346,8 +346,8 @@ public:
mLogger(Debug) << FUNLOG << ": unplugging sinks and sources";
//
- // Disconnect everybody, eating up exceptions in case things have gone away. This is a perfect spot
- // for oneways or, at the very least, AMI. XXX
+ // TODO: Disconnect everybody, eating up exceptions in case things have gone away. This is a perfect spot for
+ // oneways or, at the very least, AMI.
//
for (vector<OutgoingPairing>::iterator i = outgoing.begin(); i != outgoing.end(); ++i)
{
@@ -990,12 +990,12 @@ QueuedTasks createMediaConnectTasks(const SessionWrapperPtr& session, const Medi
QueuedTasks tasks;
MediaConnectorBuilderPtr materials(new MediaConnectorBuilder);
materials->peer = peer;
- tasks.push_front(new GetMediaSession(session, materials));
- tasks.push_front(new GetSinks(materials));
- tasks.push_front(new GetSources(materials));
- tasks.push_front(new GetCompatiblePairings(splicer, materials));
- tasks.push_front(new MakeConnections(materials));
- tasks.push_front(new CreateAndRegisterConnector(session, splicer, materials));
+ tasks.push_back(new GetMediaSession(session, materials));
+ tasks.push_back(new GetSinks(materials));
+ tasks.push_back(new GetSources(materials));
+ tasks.push_back(new GetCompatiblePairings(splicer, materials));
+ tasks.push_back(new MakeConnections(materials));
+ tasks.push_back(new CreateAndRegisterConnector(session, splicer, materials));
return tasks;
}
diff --git a/src/SessionWrapper.cpp b/src/SessionWrapper.cpp
index 7c618c9..39cfbdc 100644
--- a/src/SessionWrapper.cpp
+++ b/src/SessionWrapper.cpp
@@ -69,7 +69,7 @@ public:
//
// These exceptions indicate something is wrong with the request on this object. We should not expect that
// it could ever exceed. ObjectNotExistException is included in this catch.
- // XXX- it might be reasonable to disconnect this session for this!
+ // TODO- it might be reasonable to disconnect this session for this!
//
mLogger(Warning) << "exception when calling connect() on " << mSession->id() << ": " << ex.what();
mSession->destroy();
@@ -281,18 +281,21 @@ QueuedTasks createShutdownTasks(const SessionWrapperPtr& session, const SessionL
// Tasks are a queued, so they go in order that they will be processed.
//
QueuedTasks tasks;
- tasks.push_front(new SetStateTask(session, BridgedSessionState::Disconnected));
- tasks.push_front(new RemoveBridgeTask(session, listener));
- tasks.push_front(new ShutdownMediaTask(session));
- tasks.push_front(new SessionStopTask(session, code));
+ tasks.push_back(new SetStateTask(session, BridgedSessionState::Disconnected));
+ tasks.push_back(new RemoveBridgeTask(session, listener));
+ tasks.push_back(new SessionStopTask(session, code));
+ //
+ // TODO: These two tasks should be reversed really.
+ //
+ tasks.push_back(new ShutdownMediaTask(session));
return tasks;
}
QueuedTasks createSetupTasks(const SessionWrapperPtr& session)
{
QueuedTasks tasks;
- tasks.push_front(new SetStateTask(session, BridgedSessionState::Connected));
- tasks.push_front(new ConnectMediaTask(session));
+ tasks.push_back(new SetStateTask(session, BridgedSessionState::Connected));
+ tasks.push_back(new ConnectMediaTask(session));
return tasks;
}
diff --git a/src/Tasks.h b/src/Tasks.h
index 85a61f6..f046cbc 100644
--- a/src/Tasks.h
+++ b/src/Tasks.h
@@ -139,7 +139,7 @@ public:
mStopped = false;
}
}
- if (t->execute())
+ if (t && t->execute())
{
succeeded();
}
@@ -167,6 +167,11 @@ public:
if (!mStopped)
{
mTasks.pop_front();
+ if (mTasks.size() == 0)
+ {
+ mStopped = true;
+ break;
+ }
t = mTasks.front();
}
}
@@ -231,6 +236,7 @@ public:
newTask->setListener(this);
boost::unique_lock<boost::shared_mutex> lock(mLock);
restart = (mTasks.size() == 0);
+ mStopped = true;
mTasks.push_back(newTask);
}
if (restart)
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index 7ae5176..788d7dd 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -352,9 +352,20 @@ public:
BOOST_CHECK(servant->createCalls() == 1);
channel.commands()->getlog(idA, log);
- BOOST_CHECK(find(log, "stop"));
+ bool findStop = find(log, "stop");
+ if (!findStop)
+ {
+ dumplog(log);
+ }
+ BOOST_CHECK(findStop);
+
channel.commands()->getlog(idB, log);
- BOOST_CHECK(find(log, "stop"));
+ findStop = find(log, "stop");
+ if (!findStop)
+ {
+ dumplog(log);
+ }
+ BOOST_CHECK(findStop);
}
catch (const Ice::Exception& ex)
{
@@ -447,9 +458,19 @@ public:
BOOST_CHECK(servant->createCalls() == 1);
channel.commands()->getlog(idA, log);
- BOOST_CHECK(find(log, "stop"));
+ bool findStop = find(log, "stop");
+ if (!findStop)
+ {
+ dumplog(log);
+ }
+ BOOST_CHECK(findStop);
channel.commands()->getlog(idB, log);
- BOOST_CHECK(find(log, "stop"));
+ findStop = find(log, "stop");
+ if (!findStop)
+ {
+ dumplog(log);
+ }
+ BOOST_CHECK(findStop);
mgrPrx->removeDefaultBridgeListener(bridgeListenerPrx);
mgrPrx->removeListener(listenerPrx);
}
@@ -527,7 +548,7 @@ public:
{
for(std::vector<std::string>::const_iterator i = seq.begin(); i != seq.end(); ++i)
{
- std::cerr << *i << std::endl;
+ std::cout << *i << std::endl;
}
}
-----------------------------------------------------------------------
--
asterisk-scf/integration/bridging.git
More information about the asterisk-scf-commits
mailing list