[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "standalone" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue May 24 17:30:06 CDT 2011
branch "standalone" has been created
at e093fe275bd28b4566dc9541bf75288cb0a31d02 (commit)
- Log -----------------------------------------------------------------
commit e093fe275bd28b4566dc9541bf75288cb0a31d02
Author: Ken Hunt <ken.hunt at digium.com>
Date: Tue May 24 17:25:02 2011 -0500
A patch to support the .Standalone property for the routing service to
allow disabling state replication altogether. This property is planned to
be available for all components soon.
diff --git a/src/BasicRoutingServiceApp.cpp b/src/BasicRoutingServiceApp.cpp
index cc0cd4f..38f768d 100644
--- a/src/BasicRoutingServiceApp.cpp
+++ b/src/BasicRoutingServiceApp.cpp
@@ -526,6 +526,7 @@ void BasicRoutingServiceApp::locateStateReplicator()
lg(Error) << "StateReplicator not found. Check configuration.";
throw;
}
+
}
/**
@@ -546,8 +547,10 @@ void BasicRoutingServiceApp::initialize()
bool active = !(mCommunicator->getProperties()->getPropertyWithDefault(mAppName + ".Standby", "no") == "yes");
+ bool standalone = (mCommunicator->getProperties()->getPropertyWithDefault(mAppName + ".Standalone", "no") == "yes");
+
// Create the replication context.
- mReplicationContext = ReplicationContextPtr(new ReplicationContext(active));
+ mReplicationContext = ReplicationContextPtr(new ReplicationContext(active, standalone));
mEventPublisher = new RoutingServiceEventPublisher(mAdapter);
diff --git a/src/ReplicationContext.cpp b/src/ReplicationContext.cpp
index 5541373..ad58952 100644
--- a/src/ReplicationContext.cpp
+++ b/src/ReplicationContext.cpp
@@ -28,22 +28,24 @@ namespace BasicRoutingService
class ReplicationContextPriv
{
public:
- ReplicationContextPriv(bool componentIsActive) :
+ ReplicationContextPriv(bool componentIsActive, bool standalone) :
mActive(componentIsActive),
+ mStandalone(standalone),
mTestContext(new TestContext())
{
}
ReplicatorServicePrx mReplicatorService;
bool mActive;
+ bool mStandalone;
TestContextPtr mTestContext;
boost::shared_mutex mLock;
};
-ReplicationContext::ReplicationContext(bool componentIsActive)
- : mImpl(new ReplicationContextPriv(componentIsActive))
+ReplicationContext::ReplicationContext(bool componentIsActive, bool standalone)
+ : mImpl(new ReplicationContextPriv(componentIsActive, standalone))
{
}
@@ -51,7 +53,7 @@ bool ReplicationContext::isReplicating()
{
boost::shared_lock<boost::shared_mutex> lock(mImpl->mLock);
- return ((mImpl->mActive) && (mImpl->mReplicatorService.initialize() != 0));
+ return ((mImpl->mActive) && (!mImpl->mStandalone) && (mImpl->mReplicatorService.initialize() != 0));
}
bool ReplicationContext::isComponentActive()
@@ -61,6 +63,13 @@ bool ReplicationContext::isComponentActive()
return mImpl->mActive;
}
+bool ReplicationContext::isStandalone()
+{
+ boost::shared_lock<boost::shared_mutex> lock(mImpl->mLock);
+
+ return mImpl->mStandalone;
+}
+
void ReplicationContext::setComponentActive()
{
boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
diff --git a/src/ReplicationContext.h b/src/ReplicationContext.h
index d335864..1e82e00 100644
--- a/src/ReplicationContext.h
+++ b/src/ReplicationContext.h
@@ -35,10 +35,10 @@ class ReplicationContextPriv;
class ReplicationContext
{
public:
- ReplicationContext(bool componentIsActive);
+ ReplicationContext(bool componentIsActive, bool standalone);
/**
- * Returns indicator of whether this component is both active and has a valid
+ * Returns true if this component is active, non-standalone and has a valid
* proxy to it's state replicator.
*/
bool isReplicating();
@@ -48,6 +48,12 @@ public:
*/
bool isComponentActive();
+ /**
+ * If true, the component is in standalone mode.
+ * @see isReplicating
+ */
+ bool isStandalone();
+
void setComponentActive();
void setComponentStandby();
commit 363404bce906ac4860b75065a3e597c2b7737f20
Merge: e1cda44 973f8ef
Author: Mark Michelson <mmichelson at digium.com>
Date: Tue May 17 10:44:45 2011 -0500
Merge branch 'master' into sip-threading
commit e1cda44f3a5e9c7d24d198a2d4958e3ad92d36e8
Author: Mark Michelson <mmichelson at digium.com>
Date: Tue May 10 17:28:24 2011 -0500
Adjust for changes in SessionCommunicationsIf.ice
diff --git a/test/MockSession.cpp b/test/MockSession.cpp
index 59fee4a..358e87a 100644
--- a/test/MockSession.cpp
+++ b/test/MockSession.cpp
@@ -70,7 +70,7 @@ MockSession::~MockSession()
BOOST_TEST_MESSAGE("Session " + mLegId + " deleted.");
}
-SessionInfoPtr MockSession::addListener(const SessionListenerPrx& listener, const Ice::Current&)
+void MockSession::internalAddListener(const SessionListenerPrx& listener)
{
mListeners.push_back(listener);
@@ -78,37 +78,54 @@ SessionInfoPtr MockSession::addListener(const SessionListenerPrx& listener, cons
{
BOOST_TEST_MESSAGE("Session " + mId + " has more than one listener.");
}
+}
- return mSessionInfo;
+void MockSession::addListener_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_addListenerPtr& cb,
+ const SessionListenerPrx& listener,
+ const Ice::Current&)
+{
+ internalAddListener(listener);
+ cb->ice_response(mSessionInfo);
}
-void MockSession::indicate(const AsteriskSCF::SessionCommunications::V1::IndicationPtr& indication, const Ice::Current&)
+void MockSession::indicate_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_indicatePtr& cb,
+ const AsteriskSCF::SessionCommunications::V1::IndicationPtr& indication,
+ const Ice::Current&)
{
AsteriskSCF::SessionCommunications::V1::ConnectIndicationPtr connect;
if ((connect = AsteriskSCF::SessionCommunications::V1::ConnectIndicationPtr::dynamicCast(indication)))
{
- for(vector<SessionListenerPrx>::iterator i = mListeners.begin(); i != mListeners.end(); ++i)
- {
- (*i)->indicated(mMyPrx, new AsteriskSCF::SessionCommunications::V1::ConnectedIndication());
- }
+ for(vector<SessionListenerPrx>::iterator i = mListeners.begin(); i != mListeners.end(); ++i)
+ {
+ (*i)->indicated(mMyPrx, new AsteriskSCF::SessionCommunications::V1::ConnectedIndication());
+ }
}
+ cb->ice_response();
}
-SessionEndpointPrx MockSession::getEndpoint(const Ice::Current&)
+void MockSession::getEndpoint_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_getEndpointPtr& cb,
+ const Ice::Current&)
{
- return mEndpointPrx;
+ cb->ice_response(mEndpointPrx);
}
-SessionInfoPtr MockSession::getInfo(const Ice::Current&)
+void MockSession::getInfo_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_getInfoPtr& cb,
+ const Ice::Current&)
{
mSessionInfo->connectedTime = mListeners.size();
- return mSessionInfo;
+ cb->ice_response(mSessionInfo);
}
-AsteriskSCF::Media::V1::SessionPrx MockSession::getMediaSession(const Ice::Current&)
+void MockSession::getMediaSession_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_getMediaSessionPtr& cb,
+ const Ice::Current&)
{
- return 0;
+ cb->ice_response(0);
}
void MockSession::removeListener(const SessionListenerPrx& listener, const Ice::Current&)
@@ -146,9 +163,11 @@ void MockSession::setProxy(const SessionPrx& sessionPrx)
mMyPrx = sessionPrx;
}
-BridgePrx MockSession::getBridge(const Ice::Current &)
+void MockSession::getBridge_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_getBridgePtr& cb,
+ const Ice::Current &)
{
- return mBridgePrx;
+ cb->ice_response(mBridgePrx);
}
/**
@@ -156,26 +175,29 @@ BridgePrx MockSession::getBridge(const Ice::Current &)
* method in this test code.
*/
void MockSession::setBridge_async(
- const AMD_Session_setBridgePtr& cb,
- const BridgePrx& bridge,
- const SessionListenerPrx& listener,
- const Ice::Current ¤t)
+ const AMD_Session_setBridgePtr& cb,
+ const BridgePrx& bridge,
+ const SessionListenerPrx& listener,
+ const Ice::Current&)
{
mBridgePrx = bridge;
mBridgeSet = true;
- addListener(listener, current);
+ internalAddListener(listener);
cb->ice_response(mSessionInfo);
}
-void MockSession::removeBridge(const SessionListenerPrx& listener,
- const Ice::Current ¤t)
+void MockSession::removeBridge_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_removeBridgePtr& cb,
+ const SessionListenerPrx& listener,
+ const Ice::Current ¤t)
{
mBridgePrx = 0;
mBridgeSet = false;
removeListener(listener, current);
+ cb->ice_response();
}
}; // RoutingTest
diff --git a/test/MockSession.h b/test/MockSession.h
index 2cc4573..68b56cd 100644
--- a/test/MockSession.h
+++ b/test/MockSession.h
@@ -32,21 +32,38 @@ public:
public:
// Overrides
- AsteriskSCF::SessionCommunications::V1::SessionInfoPtr addListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current&);
- void indicate(const AsteriskSCF::SessionCommunications::V1::IndicationPtr&, const Ice::Current&);
- AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx getEndpoint(const Ice::Current&);
- AsteriskSCF::SessionCommunications::V1::SessionInfoPtr getInfo(const Ice::Current&);
- AsteriskSCF::Media::V1::SessionPrx getMediaSession(const Ice::Current&);
+ void addListener_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_addListenerPtr& cb,
+ const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
+ const Ice::Current&);
+ void indicate_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_indicatePtr& cb,
+ const AsteriskSCF::SessionCommunications::V1::IndicationPtr&,
+ const Ice::Current&);
+ void getEndpoint_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_getEndpointPtr& cb,
+ const Ice::Current&);
+ void getInfo_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_getInfoPtr& cb,
+ const Ice::Current&);
+ void getMediaSession_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_getMediaSessionPtr& cb,
+ const Ice::Current&);
void removeListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
void start(const Ice::Current&);
void stop(const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr&, const Ice::Current&);
- AsteriskSCF::SessionCommunications::V1::BridgePrx getBridge(const Ice::Current &);
+ void getBridge_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_getBridgePtr& cb,
+ const Ice::Current &);
void setBridge_async(
const AsteriskSCF::SessionCommunications::V1::AMD_Session_setBridgePtr& cb,
const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
const Ice::Current &);
- void removeBridge(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current &);
+ void removeBridge_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_removeBridgePtr& cb,
+ const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
+ const Ice::Current &);
public:
void setProxy(const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx);
@@ -54,6 +71,12 @@ public:
void destroy();
private:
+ /**
+ * Method that encapsulates the logic of adding a listener to a session
+ * without using AMD.
+ */
+ void internalAddListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&);
+
std::string mLegId;
std::string mId;
AsteriskSCF::SessionCommunications::V1::SessionPrx mMyPrx;
commit b6b172267d19c0dae2ea8df258ac01e7ae60b367
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon May 9 16:33:25 2011 -0500
Adjust for AMD change to Session::setBridge
diff --git a/test/MockSession.cpp b/test/MockSession.cpp
index be48767..59fee4a 100644
--- a/test/MockSession.cpp
+++ b/test/MockSession.cpp
@@ -151,7 +151,13 @@ BridgePrx MockSession::getBridge(const Ice::Current &)
return mBridgePrx;
}
-SessionInfoPtr MockSession::setBridge(const BridgePrx& bridge,
+/**
+ * We're not actually dispatching this AMD
+ * method in this test code.
+ */
+void MockSession::setBridge_async(
+ const AMD_Session_setBridgePtr& cb,
+ const BridgePrx& bridge,
const SessionListenerPrx& listener,
const Ice::Current ¤t)
{
@@ -160,7 +166,7 @@ SessionInfoPtr MockSession::setBridge(const BridgePrx& bridge,
addListener(listener, current);
- return mSessionInfo;
+ cb->ice_response(mSessionInfo);
}
void MockSession::removeBridge(const SessionListenerPrx& listener,
diff --git a/test/MockSession.h b/test/MockSession.h
index df4b5cf..2cc4573 100644
--- a/test/MockSession.h
+++ b/test/MockSession.h
@@ -41,7 +41,11 @@ public:
void start(const Ice::Current&);
void stop(const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr&, const Ice::Current&);
AsteriskSCF::SessionCommunications::V1::BridgePrx getBridge(const Ice::Current &);
- AsteriskSCF::SessionCommunications::V1::SessionInfoPtr setBridge(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current &);
+ void setBridge_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_Session_setBridgePtr& cb,
+ const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
+ const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
+ const Ice::Current &);
void removeBridge(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current &);
public:
-----------------------------------------------------------------------
--
asterisk-scf/integration/routing.git
More information about the asterisk-scf-commits
mailing list