[asterisk-scf-commits] asterisk-scf/release/routing.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue May 24 18:03:47 CDT 2011


branch "master" has been updated
       via  8cb6c0106886c45b6ffaec07c4e48f455f935ded (commit)
      from  70e610ebbfb51157792e19c644ab544927606154 (commit)

Summary of changes:
 src/BasicRoutingServiceApp.cpp |    5 ++++-
 src/ReplicationContext.cpp     |   17 +++++++++++++----
 src/ReplicationContext.h       |   10 ++++++++--
 3 files changed, 25 insertions(+), 7 deletions(-)


- Log -----------------------------------------------------------------
commit 8cb6c0106886c45b6ffaec07c4e48f455f935ded
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();
 

-----------------------------------------------------------------------


-- 
asterisk-scf/release/routing.git



More information about the asterisk-scf-commits mailing list