[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "retry_deux" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Apr 13 11:39:34 CDT 2012
branch "retry_deux" has been updated
via 46ec3fe223bcbdfda572f468a66f9e6fdf6969d2 (commit)
from e647bc9cb1ccf292f15ba40fa2b7c24a786915d2 (commit)
Summary of changes:
src/BridgeReplicatorStateListenerI.cpp | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit 46ec3fe223bcbdfda572f468a66f9e6fdf6969d2
Author: Brent Eagles <beagles at digium.com>
Date: Fri Apr 13 14:05:45 2012 -0230
Add a cache to the replication listener. Where direct internal methods are
used to satisfy state changes, it is simply safer to stop duplicates here.
diff --git a/src/BridgeReplicatorStateListenerI.cpp b/src/BridgeReplicatorStateListenerI.cpp
index b6390ba..f0b87ed 100644
--- a/src/BridgeReplicatorStateListenerI.cpp
+++ b/src/BridgeReplicatorStateListenerI.cpp
@@ -19,6 +19,7 @@
#include <AsteriskSCF/Replication/StateReplicator.h>
#include "BridgeServiceConfig.h"
#include "DebugUtil.h"
+#include <AsteriskSCF/Operations/OperationContextCache.h>
#include <map>
#include <string>
@@ -37,7 +38,9 @@ public:
ListenerI(const Logger& logger, const BridgeManagerServantPtr& manager) :
mLogger(logger),
- mManager(manager)
+ mManager(manager),
+ mContextCache(AsteriskSCF::Operations::OperationContextCache::create(
+ AsteriskSCF::Operations::DEFAULT_TTL_SECONDS))
{
}
@@ -61,6 +64,13 @@ public:
void stateRemoved(const AsteriskSCF::System::V1::OperationContextPtr& operationContext,
const Ice::StringSeq& itemKeys, const Ice::Current& current)
{
+ if (!mContextCache->addOperationContext(operationContext))
+ {
+ //
+ // Duplicate state changes need not be processed.
+ //
+ return;
+ }
for (Ice::StringSeq::const_iterator k = itemKeys.begin(); k != itemKeys.end(); ++k)
{
ReplicatedStateItemPtr item;
@@ -155,6 +165,17 @@ public:
void stateSet(const AsteriskSCF::System::V1::OperationContextPtr& context,
const ReplicatedStateItemSeq& items, const Ice::Current& current)
{
+ if (!mContextCache->addOperationContext(context))
+ {
+ //
+ // Duplicate state changes need not be processed. While it may
+ // not be absolutely necessary to do this here since the
+ // servants might be better off handling the duplicate calls,
+ // there should be no harm in dealing with duplicates here.
+ //
+ return;
+ }
+
for (ReplicatedStateItemSeq::const_iterator i = items.begin(); i != items.end(); ++i)
{
assert(*i);
@@ -343,6 +364,7 @@ private:
Logger mLogger;
BridgeManagerServantPtr mManager;
map<string, map<string, ReplicatedStateItemPtr> > mBridgeItemMap;
+ AsteriskSCF::Operations::OperationContextCachePtr mContextCache;
};
}
-----------------------------------------------------------------------
--
asterisk-scf/integration/bridging.git
More information about the asterisk-scf-commits
mailing list