[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
Fri Apr 8 10:14:53 CDT 2011
branch "async-bridging" has been updated
via 1cd72b5ccca16a39cb06187480e6465f3ca3811f (commit)
from 89acedd55e118224f161bb5068d327920755a1e5 (commit)
Summary of changes:
src/BridgeImpl.cpp | 55 ++++++++++++++++++++++++++-------------------------
1 files changed, 28 insertions(+), 27 deletions(-)
- Log -----------------------------------------------------------------
commit 1cd72b5ccca16a39cb06187480e6465f3ca3811f
Author: Brent Eagles <beagles at digium.com>
Date: Fri Apr 8 12:43:41 2011 -0230
Remove shutdown worker thread and have the task call shutdown() on the object
via AMI.
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index f4a8adc..6df4d44 100644
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -186,28 +186,6 @@ static void checkSessions(const SessionSeq& sessions)
}
}
-class ShutdownThread : public IceUtil::Thread
-{
-public:
- ShutdownThread(const BridgePrx& bridge) :
- mBridge(bridge)
- {
- }
-
- void run()
- {
- try
- {
- mBridge->shutdown();
- }
- catch (...)
- {
- }
- }
-private:
- BridgePrx mBridge;
-};
-
class SessionsTracker : public IceUtil::Shared
{
public:
@@ -424,11 +402,31 @@ protected:
{
if (mBridge->sessions()->size() < 2 && mPrx)
{
- IceUtil::Handle<IceUtil::Thread> t = new ShutdownThread(mPrx);
- t->start();
+ mPrx->begin_shutdown(newCallback_Bridge_shutdown(this, &CheckShutdown::done,
+ &CheckShutdown::failed));
}
+ //
+ // We don't care about the result really. The CheckShutdown instance will hang
+ // around because of the AMI request so the completion of the request will not
+ // have an issue.
+ //
return true;
}
+
+ void done()
+ {
+ //
+ // We don't care about the ending.
+ //
+ }
+
+ void failed(const Ice::Exception&)
+ {
+ //
+ // Operationally, we don't really care but we should probably log
+ //
+ }
+
private:
BridgeImplPtr mBridge;
BridgePrx mPrx;
@@ -529,9 +527,12 @@ void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback, co
{
try
{
- if (sessions.size() == 0 && callback)
+ if (sessions.empty())
{
- callback->ice_response();
+ if (callback)
+ {
+ callback->ice_response();
+ }
return;
}
checkSessions(sessions);
@@ -567,7 +568,7 @@ void BridgeImpl::removeSessions_async(const AMD_Bridge_removeSessionsPtr& callba
{
try
{
- if (sessions.size() == 0)
+ if (sessions.empty())
{
callback->ice_response();
return;
-----------------------------------------------------------------------
--
asterisk-scf/integration/bridging.git
More information about the asterisk-scf-commits
mailing list