[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
Tue Feb 15 09:14:47 CST 2011
branch "async-bridging" has been updated
via d8d244cf8c1bf16fe12911fc53b38a805a351780 (commit)
from 840b5d0a42573922616e25bc3324fb23e08066c7 (commit)
Summary of changes:
src/BridgeImpl.cpp | 51 +++++++++++++++++++++++++++++++++++++++-----
src/BridgeImpl.h | 8 ++++++-
src/BridgeManagerImpl.cpp | 23 +++++++++++++++++++-
3 files changed, 74 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit d8d244cf8c1bf16fe12911fc53b38a805a351780
Author: Brent Eagles <beagles at digium.com>
Date: Tue Feb 15 11:44:28 2011 -0330
converting method signatures (the methods are not truly async yet!)
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 8e0badb..3f09183 100644
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -147,8 +147,11 @@ public:
//
// AsteriskSCF::SessionCommunications::Bridging::Bridge Interface
//
- void addSessions(const SessionSeq& sessions, const Ice::Current& current);
+ void addSessions(const SessionSeq& sessions);
+ void addSessions_async(const AMD_Bridge_addSessionsPtr& callback, const SessionSeq& sessions, const Ice::Current&);
void removeSessions(const SessionSeq& sessions, const Ice::Current& current);
+ void removeSessions_async(const AMD_Bridge_removeSessionsPtr& callback, const SessionSeq& sessions,
+ const Ice::Current&);
SessionSeq listSessions(const Ice::Current&);
void shutdown(const Ice::Current& current);
@@ -479,7 +482,7 @@ BridgeImpl::~BridgeImpl()
//
}
-void BridgeImpl::addSessions(const SessionSeq& sessions, const Ice::Current& current)
+void BridgeImpl::addSessions(const SessionSeq& sessions)
{
if (sessions.size() == 0)
{
@@ -488,10 +491,10 @@ void BridgeImpl::addSessions(const SessionSeq& sessions, const Ice::Current& cur
checkSessions(sessions);
SessionSeq addedSessions;
{
- boost::unique_lock<boost::shared_mutex> lock(mLock);
- statePreCheck();
- mLogger(Debug) << FUNLOG << ": adding " << sessions.size() << " sessions to "
- << current.adapter->getCommunicator()->identityToString(current.id);
+ //
+ // This is an internal only method that is used when initializing the bridge, so locking is not
+ // required.
+ //
for (SessionSeq::const_iterator i = sessions.begin();
i != sessions.end(); ++i)
{
@@ -570,6 +573,24 @@ void BridgeImpl::addSessions(const SessionSeq& sessions, const Ice::Current& cur
}
}
+void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback, const SessionSeq& sessions,
+ const Ice::Current& current)
+{
+ try
+ {
+ addSessions(sessions);
+ callback->ice_response();
+ }
+ catch (const std::exception& ex)
+ {
+ callback->ice_exception(ex);
+ }
+ catch (...)
+ {
+ callback->ice_exception();
+ }
+}
+
void BridgeImpl::removeSessions(
const SessionSeq& sessions, const Ice::Current& current)
{
@@ -629,6 +650,24 @@ void BridgeImpl::removeSessions(
}
}
+void BridgeImpl::removeSessions_async(const AMD_Bridge_removeSessionsPtr& callback, const SessionSeq& sessions,
+ const Ice::Current& current)
+{
+ try
+ {
+ removeSessions(sessions, current);
+ callback->ice_response();
+ }
+ catch (const std::exception& ex)
+ {
+ callback->ice_exception(ex);
+ }
+ catch (...)
+ {
+ callback->ice_exception();
+ }
+}
+
SessionSeq BridgeImpl::listSessions(const Ice::Current& current)
{
mLogger(Debug) << FUNLOG << ":" << objectIdFromCurrent(current);
diff --git a/src/BridgeImpl.h b/src/BridgeImpl.h
index d20be7a..00c3b15 100644
--- a/src/BridgeImpl.h
+++ b/src/BridgeImpl.h
@@ -95,6 +95,13 @@ public:
**/
virtual void activate(const AsteriskSCF::SessionCommunications::V1::BridgePrx& proxy) = 0;
+ /**
+ *
+ * Non-Ice mediated for adding sessions so the bridge manager can add them directly.
+ *
+ **/
+ virtual void addSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions) = 0;
+
/**
*
@@ -102,7 +109,6 @@ public:
* TODO: complete documentation.
*
**/
-
virtual AsteriskSCF::Bridge::V1::BridgeStateItemPtr getState() = 0;
virtual void updateState(const AsteriskSCF::Bridge::V1::BridgeStateItemPtr& state) = 0;
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index 008c8df..3bf7612 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -62,6 +62,9 @@ public:
//
BridgePrx createBridge(const SessionSeq& endpoints, const BridgeListenerPrx& listener, const Ice::Current& current);
+ void createBridge_async(const AMD_BridgeManager_createBridgePtr& request, const SessionSeq& endpoints,
+ const BridgeListenerPrx& listener, const Ice::Current&);
+
void addListener(const BridgeManagerListenerPrx& listener, const Ice::Current& current);
void removeListener(const BridgeManagerListenerPrx& listener, const Ice::Current& current);
@@ -208,11 +211,29 @@ BridgePrx BridgeManagerImpl::createBridge(const SessionSeq& sessions,
//
// Don't forget to add the initial sessions.
//
- bridge->addSessions(sessions, current);
+ bridge->addSessions(sessions);
return info.proxy;
}
+void BridgeManagerImpl::createBridge_async(const AMD_BridgeManager_createBridgePtr& callback,
+ const SessionSeq& endpoints, const BridgeListenerPrx& listener, const Ice::Current& current)
+{
+ try
+ {
+ BridgePrx result = createBridge(endpoints, listener, current);
+ callback->ice_response(result);
+ }
+ catch (const std::exception& ex)
+ {
+ callback->ice_exception(ex);
+ }
+ catch (...)
+ {
+ callback->ice_exception();
+ }
+}
+
void BridgeManagerImpl::addListener(const BridgeManagerListenerPrx& listener, const Ice::Current& current)
{
mLogger(Debug) << FUNLOG << ":" << objectIdFromCurrent(current);
-----------------------------------------------------------------------
--
asterisk-scf/integration/bridging.git
More information about the asterisk-scf-commits
mailing list