[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "retry_deux" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Apr 11 17:25:04 CDT 2012
branch "retry_deux" has been updated
via c94100e55d40217387944ec8d339281cde69dfe2 (commit)
from c406f9bee62ce30dc9417b74a9aac2e8a178d5c1 (commit)
Summary of changes:
.../BasicRoutingStateReplicationIf.ice | 23 +++------
...nectBridgedSessionsWithDestinationOperation.cpp | 8 ++-
...onnectBridgedSessionsWithDestinationOperation.h | 2 +-
src/EndpointRegistry.cpp | 2 +-
src/OperationReplicaCache.h | 4 +-
src/RouteSessionOperation.cpp | 8 ++-
src/RouteSessionOperation.h | 2 +-
src/RoutingStateReplicatorListener.cpp | 48 +-------------------
test/TestRouting.cpp | 10 +++--
9 files changed, 30 insertions(+), 77 deletions(-)
- Log -----------------------------------------------------------------
commit c94100e55d40217387944ec8d339281cde69dfe2
Author: Ken Hunt <ken.hunt at digium.com>
Date: Wed Apr 11 17:23:44 2012 -0500
Cleaned up replication issues and a couple of errors in the unit test changes.
diff --git a/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice b/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice
index 4a5012a..c485818 100644
--- a/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice
@@ -52,6 +52,7 @@ module V1
["visitor:RoutingStateItemVisitor"] class RoutingStateItem
{
string key;
+ AsteriskSCF::System::V1::OperationContext initiatingContext;
};
sequence<RoutingStateItem> RoutingStateItemSeq;
@@ -81,14 +82,6 @@ module V1
idempotent RoutingStateItemSeq getAllState();
};
- /**
- * All transient operations will derive from this.
- */
- class OperationStateItem extends RoutingStateItem
- {
- AsteriskSCF::System::V1::OperationContext initiatingContext;
- };
-
///////////////////////////////////////////////////////////////////////
// These state items represent the state transistions
// of the RouteSession operation.
@@ -98,7 +91,7 @@ module V1
* The key (in the base state item) is the operationId of this
* operation + RouteSessionOpStartKeyMod
*/
- class RouteSessionOpStart extends OperationStateItem
+ class RouteSessionOpStart extends RoutingStateItem
{
AsteriskSCF::SessionCommunications::V1::Session *source;
string destination;
@@ -113,7 +106,7 @@ module V1
* The key (in the base state item) is the operationId of this
* operation + RouteSessionOpWaitLookupKeyMod
*/
- class RouteSessionOpWaitLookupState extends OperationStateItem
+ class RouteSessionOpWaitLookupState extends RoutingStateItem
{
AsteriskSCF::Core::Endpoint::V1::EndpointSeq endpoints;
AsteriskSCF::System::V1::OperationContextSeq sessionCreateContexts;
@@ -126,7 +119,7 @@ module V1
* The key (in the base state item) is the operationId of this
* operation + RouteSessionOpBridgingKeyMod
*/
- class RouteSessionOpBridgingState extends OperationStateItem
+ class RouteSessionOpBridgingState extends RoutingStateItem
{
AsteriskSCF::SessionCommunications::V1::Bridge* bridge;
};
@@ -141,7 +134,7 @@ module V1
* The key (in the base state item) is the operationId of this
* operation + ConnectBridgedSessionsWithDestStartKeyMod
*/
- class ConnectBridgedSessionsWithDestinationOpStart extends OperationStateItem
+ class ConnectBridgedSessionsWithDestinationOpStart extends RoutingStateItem
{
AsteriskSCF::SessionCommunications::V1::Session *sessionToReplace;
string destination;
@@ -156,7 +149,7 @@ module V1
* The key (in the base state item) is the operationId of this
* operation + ConnectBridgedSessionsWithDestWaitLookupKeyMod
*/
- class ConnectBridgedSessionsWithDestinationOpWaitLookupState extends OperationStateItem
+ class ConnectBridgedSessionsWithDestinationOpWaitLookupState extends RoutingStateItem
{
AsteriskSCF::Core::Endpoint::V1::EndpointSeq endpoints;
AsteriskSCF::SessionCommunications::V1::SessionSeq remainingSessions;
@@ -170,7 +163,7 @@ module V1
* The key (in the base state item) is the operationId of this
* operation + ConnectBridgedSessionsWithDestBridgingKeyMod
*/
- class ConnectBridgedSessionsWithDestinationOpBridgingState extends OperationStateItem
+ class ConnectBridgedSessionsWithDestinationOpBridgingState extends RoutingStateItem
{
AsteriskSCF::SessionCommunications::V1::Bridge* bridge;
};
@@ -187,7 +180,7 @@ module V1
* Represents an added endpoint locator.
* The key (in the base state item) is the locator id.
*/
- class EndpointLocatorState extends OperationStateItem
+ class EndpointLocatorState extends RoutingStateItem
{
AsteriskSCF::Core::Routing::V1::RegExSeq regExList;
AsteriskSCF::Core::Routing::V1::EndpointLocator *locator;
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.cpp b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
index 3bfa259..d66a72d 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.cpp
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
@@ -53,13 +53,14 @@ public:
ConnectBridgedSessionsWithDestReplicatingListener(ConnectBridgedSessionsWithDestinationOperationPtr op,
const RoutingReplicationContextPtr& replication)
: mOperation(op),
- mReplicationContext(replication)
+ mReplicationContext(replication),
+ mOperationId(mOperation->getOperationContext()->id)
{
}
~ConnectBridgedSessionsWithDestReplicatingListener()
{
- lg(Debug) << "ConnectBridgedSessionsWithDestReplicatingListener() being destroyed for operation " << mOperation->getOperationContext()->id;
+ lg(Debug) << "ConnectBridgedSessionsWithDestReplicatingListener() being destroyed for operation " << mOperationId;
}
/**
@@ -193,6 +194,7 @@ private:
RoutingStateItemSeq mReplicatedState;
ConnectBridgedSessionsWithDestinationOperationPtr mOperation;
RoutingReplicationContextPtr mReplicationContext;
+ std::string mOperationId;
}; // end ConnectBridgedSessionsWithDestReplicatingListener
@@ -305,7 +307,7 @@ ConnectBridgedSessionsWithDestinationOperation::~ConnectBridgedSessionsWithDesti
}
void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(
- const OperationStateItemPtr& stateItem)
+ const RoutingStateItemPtr& stateItem)
{
ConnectBridgedSessionsWithDestinationOpStartPtr start;
ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr waitLookup;
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.h b/src/ConnectBridgedSessionsWithDestinationOperation.h
index 35e6052..0b22d6c 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.h
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.h
@@ -99,7 +99,7 @@ public:
/**
* Update a replica object with new state information.
*/
- void reflectUpdate(const AsteriskSCF::Replication::BasicRoutingService::V1::OperationStateItemPtr& stateItem);
+ void reflectUpdate(const AsteriskSCF::Replication::BasicRoutingService::V1::RoutingStateItemPtr& stateItem);
/**
* Set the state machine into the highest state possible based on all of the state updates
diff --git a/src/EndpointRegistry.cpp b/src/EndpointRegistry.cpp
index 1b488f8..add7281 100644
--- a/src/EndpointRegistry.cpp
+++ b/src/EndpointRegistry.cpp
@@ -250,7 +250,7 @@ public:
}
catch(const Ice::Exception& e)
{
- lg(Debug) << "EndpointRegistry unable to replicate addEndpointLocator(): " << e.what();
+ lg(Debug) << "EndpointRegistry unable to replicate setEndpointLocatorDestinationIds(): " << e.what();
}
}
}
diff --git a/src/OperationReplicaCache.h b/src/OperationReplicaCache.h
index 5a272c5..9e39668 100644
--- a/src/OperationReplicaCache.h
+++ b/src/OperationReplicaCache.h
@@ -37,7 +37,7 @@ class OperationCachePriv;
class OperationReplicaCachePriv;
class SessionContext;
-typedef std::map<std::string, AsteriskSCF::Replication::BasicRoutingService::V1::OperationStateItemPtr> StateItemMapType;
+typedef std::map<std::string, AsteriskSCF::Replication::BasicRoutingService::V1::RoutingStateItemPtr> StateItemMapType;
/**
* For each operation id, we're going to cache the all the state items for the operation.
@@ -71,7 +71,7 @@ public:
{
}
- void cacheOperationState(const AsteriskSCF::Replication::BasicRoutingService::V1::OperationStateItemPtr& item)
+ void cacheOperationState(const AsteriskSCF::Replication::BasicRoutingService::V1::RoutingStateItemPtr& item)
{
boost::unique_lock<boost::shared_mutex> lock(mLock);
diff --git a/src/RouteSessionOperation.cpp b/src/RouteSessionOperation.cpp
index 69fa2ba..095e793 100644
--- a/src/RouteSessionOperation.cpp
+++ b/src/RouteSessionOperation.cpp
@@ -55,13 +55,14 @@ public:
RouteSessionReplicatingListener(RouteSessionOperationPtr op,
const RoutingReplicationContextPtr& replicationContext)
: mOperation(op),
- mReplicationContext(replicationContext)
+ mReplicationContext(replicationContext),
+ mOperationId(mOperation->getOperationContext()->id)
{
}
~RouteSessionReplicatingListener()
{
- lg(Debug) << "RouteSessionReplicatingListener() being destroyed for operation context " << mOperation->getOperationContext()->id;
+ lg(Debug) << "RouteSessionReplicatingListener() being destroyed for operation context " << mOperationId;
}
/**
@@ -191,6 +192,7 @@ private:
RoutingStateItemSeq mReplicatedState;
RouteSessionOperationPtr mOperation;
RoutingReplicationContextPtr mReplicationContext;
+ std::string mOperationId;
};
/**
@@ -301,7 +303,7 @@ RouteSessionOperationPtr RouteSessionOperation::createReplica(
return op;
}
-void RouteSessionOperation::reflectUpdate(const AsteriskSCF::Replication::BasicRoutingService::V1::OperationStateItemPtr& stateItem)
+void RouteSessionOperation::reflectUpdate(const AsteriskSCF::Replication::BasicRoutingService::V1::RoutingStateItemPtr& stateItem)
{
RouteSessionOpStartPtr start;
RouteSessionOpWaitLookupStatePtr waitLookup;
diff --git a/src/RouteSessionOperation.h b/src/RouteSessionOperation.h
index a665e7a..8ca1da9 100644
--- a/src/RouteSessionOperation.h
+++ b/src/RouteSessionOperation.h
@@ -97,7 +97,7 @@ public:
/**
* Update a replica object with new state information.
*/
- void reflectUpdate(const AsteriskSCF::Replication::BasicRoutingService::V1::OperationStateItemPtr& stateItem);
+ void reflectUpdate(const AsteriskSCF::Replication::BasicRoutingService::V1::RoutingStateItemPtr& stateItem);
/**
* Set the state machine into the highest state possible based on all of the state updates
diff --git a/src/RoutingStateReplicatorListener.cpp b/src/RoutingStateReplicatorListener.cpp
index 343bde4..7d7de7f 100755
--- a/src/RoutingStateReplicatorListener.cpp
+++ b/src/RoutingStateReplicatorListener.cpp
@@ -70,52 +70,6 @@ public:
private:
RoutingStateReplicatorListenerPriv *mImpl;
- // Used an intermediate class in the slice types, and the visitor didn't pick up the leaf classes to visit.
- void visitOperationStateItem(const OperationStateItemPtr& operation)
- {
- RouteSessionOpStartPtr routeSessinOpStart = RouteSessionOpStartPtr::dynamicCast(operation);
- if (routeSessinOpStart != 0)
- {
- visitRouteSessionOpStart(routeSessinOpStart);
- return;
- }
-
- RouteSessionOpWaitLookupStatePtr routeSessionWait = RouteSessionOpWaitLookupStatePtr::dynamicCast(operation);
- if (routeSessionWait != 0)
- {
- visitRouteSessionOpWaitLookupState(routeSessionWait);
- return;
- }
-
- RouteSessionOpBridgingStatePtr routeBridging = RouteSessionOpBridgingStatePtr::dynamicCast(operation);
- if (routeBridging != 0)
- {
- visitRouteSessionOpBridgingState(routeBridging);
- return;
- }
-
- ConnectBridgedSessionsWithDestinationOpStartPtr connectWithDestStart = ConnectBridgedSessionsWithDestinationOpStartPtr::dynamicCast(operation);
- if (connectWithDestStart != 0)
- {
- visitConnectBridgedSessionsWithDestinationOpStart(connectWithDestStart);
- return;
- }
-
- ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr connectWithDestLookup = ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr::dynamicCast(operation);
- if (connectWithDestLookup != 0)
- {
- visitConnectBridgedSessionsWithDestinationOpWaitLookupState(connectWithDestLookup);
- return;
- }
-
- ConnectBridgedSessionsWithDestinationOpBridgingStatePtr connectWithDestBridge = ConnectBridgedSessionsWithDestinationOpBridgingStatePtr::dynamicCast(operation);
- if (connectWithDestBridge != 0)
- {
- visitConnectBridgedSessionsWithDestinationOpBridgingState(connectWithDestBridge);
- return;
- }
- }
-
void visitRouteSessionOpStart(const RouteSessionOpStartPtr& opState)
{
// The operation cache keeps all the collected state for an operation under the transaction id.
@@ -185,7 +139,7 @@ public:
const Ice::Current& mCurrent;
// Used an intermediate class in the slice types, and the visitor didn't pick up the leaf classes to visit.
- void visitOperationStateItem(const OperationStateItemPtr& operation)
+ void visitOperationStateItem(const RoutingStateItemPtr& operation)
{
RouteSessionOpStartPtr routeSessinOpStart = RouteSessionOpStartPtr::dynamicCast(operation);
if (routeSessinOpStart != 0)
diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index 24e4855..3dee530 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -699,7 +699,8 @@ BOOST_FIXTURE_TEST_CASE(FailoverRouteSession, PerTestFixture)
// Note we're routing using AMI with no callback. The callback would never come due to the
// way the test mode shuts down the operation. Simulates failure.
- SharedTestData::instance.sessionRouter->begin_routeSession(createContext(), session, "102", 0, session->getCaller(), session->getRedirections());
+ OperationContextPtr contextToRetry = createContext();
+ SharedTestData::instance.sessionRouter->begin_routeSession(contextToRetry, session, "102", 0, session->getCaller(), session->getRedirections());
for (int counter=0; SharedTestData::instance.endpointLocator->mLookupCalled == false; counter++)
{
@@ -728,7 +729,7 @@ BOOST_FIXTURE_TEST_CASE(FailoverRouteSession, PerTestFixture)
BOOST_CHECK(SharedTestData::instance.serviceReplicaMgmt->isActive() == true);
// Let the backup session router try to route using same operationId.
- SharedTestData::instance.backupSessionRouter->routeSession(createContext(), session, "102", 0, session->getCaller(), session->getRedirections());
+ SharedTestData::instance.backupSessionRouter->routeSession(contextToRetry, session, "102", 0, session->getCaller(), session->getRedirections());
// The lookup should not be done again.
BOOST_CHECK(!SharedTestData::instance.endpointLocator->mLookupCalled);
@@ -792,7 +793,8 @@ BOOST_FIXTURE_TEST_CASE(FailoverConnectBridgedSessWithDest, PerTestFixture)
// Now transfer to a new extension. In our test mode, this operation will never complete.
- SharedTestData::instance.sessionRouter->begin_connectBridgedSessionsWithDestination(createContext(), session, "103", true, 0);
+ OperationContextPtr contextToRetry = createContext();
+ SharedTestData::instance.sessionRouter->begin_connectBridgedSessionsWithDestination(contextToRetry, session, "103", true, 0);
for (int counter=0; SharedTestData::instance.mSessionReplaced == false; counter++)
{
@@ -823,7 +825,7 @@ BOOST_FIXTURE_TEST_CASE(FailoverConnectBridgedSessWithDest, PerTestFixture)
BOOST_CHECK(SharedTestData::instance.serviceReplicaMgmt->isActive() == true);
// Let the backup session router try to route using same operationId. Synchronous call.
- SharedTestData::instance.backupSessionRouter->connectBridgedSessionsWithDestination(createContext(), session, "103", true, 0);
+ SharedTestData::instance.backupSessionRouter->connectBridgedSessionsWithDestination(contextToRetry, session, "103", true, 0);
// The lookup should not be done again.
BOOST_CHECK(SharedTestData::instance.endpointLocator->mLookupCalled == false);
-----------------------------------------------------------------------
--
asterisk-scf/integration/routing.git
More information about the asterisk-scf-commits
mailing list