[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "route_replica" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Apr 26 20:14:30 CDT 2011
branch "route_replica" has been updated
via d2cd6936db895aa34e04cab9b573caef9f10e5eb (commit)
from c229b133b74e1a6d4ad477dc2809861b93a642ec (commit)
Summary of changes:
src/BasicRoutingServiceApp.cpp | 25 +++++-----
src/BasicRoutingStateReplicatorApp.cpp | 6 +-
src/ConnectBridgedSessionsOperation.cpp | 2 +-
...nectBridgedSessionsWithDestinationOperation.cpp | 17 ++++--
src/EndpointRegistry.cpp | 13 ++---
src/OperationReplicaCache.h | 6 +-
src/RouteSessionOperation.cpp | 15 ++++--
src/RoutingStateReplicatorListener.cpp | 50 ++++++++++----------
src/SessionListener.cpp | 4 +-
src/SessionListener.h | 4 +-
src/SessionRouterOperation.cpp | 12 +++--
src/SessionRouterOperation.h | 26 +++++------
12 files changed, 92 insertions(+), 88 deletions(-)
- Log -----------------------------------------------------------------
commit d2cd6936db895aa34e04cab9b573caef9f10e5eb
Author: Ken Hunt <ken.hunt at digium.com>
Date: Tue Apr 26 20:13:48 2011 -0500
Linux compilation sans warnings and errors.
diff --git a/src/BasicRoutingServiceApp.cpp b/src/BasicRoutingServiceApp.cpp
index eb32e51..5697ba4 100644
--- a/src/BasicRoutingServiceApp.cpp
+++ b/src/BasicRoutingServiceApp.cpp
@@ -119,6 +119,7 @@ private:
bool mInitialized;
bool mRunning;
bool mPublishTestInterface;
+ SessionContextPtr mSessionContext;
boost::shared_ptr<AsteriskSCF::Threading::SimpleWorkQueue> mWorkQueue;
std::string mAppName;
@@ -130,8 +131,6 @@ private:
Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
Discovery::V1::ServiceManagementPrx mSessionRouterManagement;
- SessionContextPtr mSessionContext;
-
// Our published interfaces.
BasicSessionRouterPtr mSessionRouter;
RoutingServiceAdminPtr mAdminInteface;
@@ -218,16 +217,16 @@ public:
mTestContext->setTestMode(mode);
}
- void setTestModeWithArgs(const ::std::string&,
+ void setTestModeWithArgs(const ::std::string& mode,
const ComponentTestParamSeq&,
const ::Ice::Current&)
{
- // NA for this component.
+ mTestContext->setTestMode(mode);
}
- void clearTestMode(const string& mode, const ::Ice::Current&)
+ void clearTestMode(const string&, const ::Ice::Current&)
{
- // NA for this component.
+ mTestContext->clearTestMode();
}
void clearTestModes(const ::Ice::Current&)
@@ -292,6 +291,8 @@ public:
}
private:
+ BasicRoutingServiceAppPtr mApp;
+
/**
* Pointer to the object adapter we exist on.
*/
@@ -301,8 +302,6 @@ private:
* Listeners that we need to push state change notifications out to.
*/
vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx> mListeners;
-
- BasicRoutingServiceAppPtr mApp;
};
bool BasicRoutingServiceApp::isActive()
@@ -537,10 +536,10 @@ void BasicRoutingServiceApp::initialize()
// component service for suspend()/resume().
mComponentServiceAdapter = mCommunicator->createObjectAdapter(mAppName + ".ComponentService");
- bool isActive = !(mCommunicator->getProperties()->getPropertyWithDefault(mAppName + ".Standby", "no") == "yes");
+ bool active = !(mCommunicator->getProperties()->getPropertyWithDefault(mAppName + ".Standby", "no") == "yes");
// Create the replication context.
- mReplicationContext = ReplicationContextPtr(new ReplicationContext(isActive));
+ mReplicationContext = ReplicationContextPtr(new ReplicationContext(active));
mEventPublisher = new RoutingServiceEventPublisher(mAdapter);
@@ -595,7 +594,7 @@ void BasicRoutingServiceApp::initialize()
mReplicatorListener = new RoutingStateReplicatorListenerImpl(mEndpointRegistry, mOperationReplicaCache);
mReplicatorListenerProxy = RoutingStateReplicatorListenerPrx::uncheckedCast(mAdapter->addWithUUID(mReplicatorListener));
- if (isActive)
+ if (active)
{
activated();
}
@@ -631,7 +630,7 @@ void BasicRoutingServiceApp::initialize()
/**
* Implementation of the required IceBox::Service start method.
*/
-void BasicRoutingServiceApp::start(const string& name, const ::Ice::CommunicatorPtr& communicator, const ::Ice::StringSeq& args)
+void BasicRoutingServiceApp::start(const string& name, const ::Ice::CommunicatorPtr& communicator, const ::Ice::StringSeq&)
{
lg(Info) << "Starting...";
@@ -738,7 +737,7 @@ void BasicRoutingServiceApp::stop()
extern "C"
{
-ASTERISK_SCF_ICEBOX_EXPORT IceBox::Service* create(::Ice::CommunicatorPtr communicator)
+ASTERISK_SCF_ICEBOX_EXPORT IceBox::Service* create(::Ice::CommunicatorPtr)
{
return new AsteriskSCF::BasicRoutingService::BasicRoutingServiceApp;
}
diff --git a/src/BasicRoutingStateReplicatorApp.cpp b/src/BasicRoutingStateReplicatorApp.cpp
index dff11e3..95cf205 100644
--- a/src/BasicRoutingStateReplicatorApp.cpp
+++ b/src/BasicRoutingStateReplicatorApp.cpp
@@ -37,7 +37,7 @@ using namespace AsteriskSCF::Core::Routing::V1;
namespace
{
-Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingServiceStateReplicator");
+Logger lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingServiceStateReplicator");
}
namespace AsteriskSCF
@@ -260,7 +260,7 @@ void BasicRoutingStateReplicatorService::initialize(const std::string& appName)
mInitialized = true;
}
-void BasicRoutingStateReplicatorService::start(const string &name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& args)
+void BasicRoutingStateReplicatorService::start(const string &name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& )
{
mCommunicator = ic;
@@ -349,7 +349,7 @@ void BasicRoutingStateReplicatorService::stop()
extern "C"
{
-ASTERISK_SCF_ICEBOX_EXPORT IceBox::Service* create(Ice::CommunicatorPtr communicator)
+ASTERISK_SCF_ICEBOX_EXPORT IceBox::Service* create(Ice::CommunicatorPtr )
{
return new BasicRoutingStateReplicatorService;
}
diff --git a/src/ConnectBridgedSessionsOperation.cpp b/src/ConnectBridgedSessionsOperation.cpp
index 358007f..84b23e6 100644
--- a/src/ConnectBridgedSessionsOperation.cpp
+++ b/src/ConnectBridgedSessionsOperation.cpp
@@ -27,7 +27,7 @@ using namespace AsteriskSCF::System::Logging;
namespace
{
-Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+Logger lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
}
namespace AsteriskSCF
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.cpp b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
index 8a6cb15..4c174f7 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.cpp
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
@@ -30,7 +30,7 @@ using namespace AsteriskSCF::StateMachine;
namespace
{
-Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+Logger lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
}
namespace AsteriskSCF
@@ -47,9 +47,9 @@ class ConnectBridgedSessionsWithDestReplicatingListener :
public:
ConnectBridgedSessionsWithDestReplicatingListener(ConnectBridgedSessionsWithDestinationOperationPtr op,
const ReplicationContextPtr& replication)
- : mOperation(op),
- mReplicationContext(replication),
- mOperationId(op->getOperationId())
+ : mOperationId(op->getOperationId()),
+ mOperation(op),
+ mReplicationContext(replication)
{
}
@@ -136,6 +136,9 @@ public:
}
break;
+ default:
+ break;
+
} // end switch
}
@@ -163,9 +166,11 @@ public:
/**
* This is called when a state transition is occuring.
+ * @param oldState The state transitioning from.
+ * @param newState The state transitioning to.
*/
- void stateTransition(ConnectBridgedSessionsWithDestinationOp::OperationState oldState,
- ConnectBridgedSessionsWithDestinationOp::OperationState newState)
+ void stateTransition(ConnectBridgedSessionsWithDestinationOp::OperationState,
+ ConnectBridgedSessionsWithDestinationOp::OperationState)
{
}
diff --git a/src/EndpointRegistry.cpp b/src/EndpointRegistry.cpp
index 5c96a51..b638818 100644
--- a/src/EndpointRegistry.cpp
+++ b/src/EndpointRegistry.cpp
@@ -241,9 +241,8 @@ public:
/**
* Utiltity to do thread-safe check for existing map entry.
*/
- bool locatorExists(const std::string& locatorId, EndpointLocatorMapConstIterator& existing)
+ bool locatorExists(const std::string& locatorId, EndpointLocatorMapIterator& existing)
{
- EndpointLocatorMapConstIterator end;
boost::shared_lock<boost::shared_mutex> lock(mLock);
existing = mEndpointLocatorMap.find(locatorId);
@@ -278,14 +277,12 @@ public:
LookupResultCollector(const AMD_EndpointLocator_lookupPtr& callback,
const std::string& destination,
const RoutingEventsPtr& eventPublisher,
- int numVotes)
+ size_t numVotes)
: mCallback(callback),
mNumVotes(numVotes),
mEventPublisher(eventPublisher),
mDestination(destination)
{
- assert(mNumVotes >= 0);
-
if (mNumVotes == 0)
{
notifyFailed();
@@ -326,7 +323,7 @@ public:
}
}
- void fail(const Ice::Exception &e)
+ void fail(const Ice::Exception &)
{
boost::lock_guard<boost::mutex> guard(mLock);
@@ -353,7 +350,7 @@ public:
private:
boost::mutex mLock;
AMD_EndpointLocator_lookupPtr mCallback;
- int mNumVotes;
+ size_t mNumVotes;
RoutingEventsPtr mEventPublisher;
std::string mDestination;
};
@@ -446,7 +443,7 @@ void EndpointRegistry::addEndpointLocator(const std::string& locatorId, const Re
lg(Debug) << "EndpointRegistry::addEndpointLocator() adding locator for " << locatorId << ". Proxy details: " << locator->ice_toString();
EndpointLocatorMapIterator existing;
- bool exists = mImpl->locatorExists( locatorId, existing);
+ bool exists = mImpl->locatorExists(locatorId, existing);
if (exists)
{
diff --git a/src/OperationReplicaCache.h b/src/OperationReplicaCache.h
index 1ab6f6e..6a06e98 100644
--- a/src/OperationReplicaCache.h
+++ b/src/OperationReplicaCache.h
@@ -76,7 +76,7 @@ public:
boost::unique_lock<boost::shared_mutex> lock(mLock);
// See if this transaction is in the cache.
- OpMapType::iterator i = mReplicas.find(item->operationId);
+ typename OpMapType::iterator i = mReplicas.find(item->operationId);
if (i == mReplicas.end())
{
// Add an entry to the cache.
@@ -104,7 +104,7 @@ public:
{
boost::unique_lock<boost::shared_mutex> lock(mLock);
- OpMapType::iterator i = mReplicas.find(transactionId);
+ typename OpMapType::iterator i = mReplicas.find(transactionId);
if (i == mReplicas.end())
{
return false;
@@ -122,7 +122,7 @@ public:
{
boost::unique_lock<boost::shared_mutex> lock(mLock);
- OpMapType::iterator i = mReplicas.find(transactionId);
+ typename OpMapType::iterator i = mReplicas.find(transactionId);
if (i != mReplicas.end())
{
mReplicas.erase(i);
diff --git a/src/RouteSessionOperation.cpp b/src/RouteSessionOperation.cpp
index 3c62105..3710edc 100644
--- a/src/RouteSessionOperation.cpp
+++ b/src/RouteSessionOperation.cpp
@@ -30,7 +30,7 @@ using namespace AsteriskSCF::StateMachine;
namespace
{
-Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+Logger lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
}
namespace AsteriskSCF
@@ -48,9 +48,9 @@ class RouteSessionReplicatingListener :
public:
RouteSessionReplicatingListener(RouteSessionOperationPtr op,
const ReplicationContextPtr& replicationContext)
- : mOperation(op),
- mReplicationContext(replicationContext),
- mTransactionId(op->getOperationId())
+ : mTransactionId(op->getOperationId()),
+ mOperation(op),
+ mReplicationContext(replicationContext)
{
}
@@ -137,6 +137,9 @@ public:
case RouteSessionOp::STATE_SEND_RESPONSE:
// The AMD caller has been notified. We'll remove the replica in shutdown() handler.
break;
+
+ default:
+ break;
}
}
@@ -165,8 +168,8 @@ public:
/**
* This callback is called when a state transition is occuring.
*/
- void stateTransition(RouteSessionOp::OperationState oldState,
- RouteSessionOp::OperationState newState)
+ void stateTransition(RouteSessionOp::OperationState, // oldState
+ RouteSessionOp::OperationState) // newState
{
}
diff --git a/src/RoutingStateReplicatorListener.cpp b/src/RoutingStateReplicatorListener.cpp
index dc48b3c..3f0691e 100644
--- a/src/RoutingStateReplicatorListener.cpp
+++ b/src/RoutingStateReplicatorListener.cpp
@@ -50,18 +50,18 @@ public:
{
}
- void stateRemovedForItems(const RoutingStateItemSeq& items, const Ice::Current& current)
+ void stateRemovedForItems(const RoutingStateItemSeq& items, const Ice::Current& )
{
// Method local visitor implementation for handling removal of state items.
- class visitor : public AsteriskSCF::BasicRoutingService::V1::RoutingStateItemVisitor
- {
- public:
- visitor(RoutingStateReplicatorListenerPriv *impl) : mImpl(impl)
- {
- }
+ class visitor : public AsteriskSCF::BasicRoutingService::V1::RoutingStateItemVisitor
+ {
+ public:
+ visitor(RoutingStateReplicatorListenerPriv *impl) : mImpl(impl)
+ {
+ }
- private:
- RoutingStateReplicatorListenerPriv *mImpl;
+ private:
+ RoutingStateReplicatorListenerPriv *mImpl;
void visitRouteSessionOpStart(const ::AsteriskSCF::BasicRoutingService::V1::RouteSessionOpStartPtr& opState)
{
@@ -69,12 +69,12 @@ public:
mImpl->mOperationReplicaCache->getRouteSessionCache()->dropOperation(opState->operationId);
}
- void visitRouteSessionOpWaitLookupState(const ::AsteriskSCF::BasicRoutingService::V1::RouteSessionOpWaitLookupStatePtr& opState)
+ void visitRouteSessionOpWaitLookupState(const ::AsteriskSCF::BasicRoutingService::V1::RouteSessionOpWaitLookupStatePtr& )
{
// Removing the Start state for this operation will clean it up.
}
- void visitRouteSessionOpBridgingState(const ::AsteriskSCF::BasicRoutingService::V1::RouteSessionOpBridgingStatePtr& opState)
+ void visitRouteSessionOpBridgingState(const ::AsteriskSCF::BasicRoutingService::V1::RouteSessionOpBridgingStatePtr& )
{
// Removing the Start state for this operation will clean it up.
}
@@ -84,12 +84,12 @@ public:
mImpl->mOperationReplicaCache->getConnectBridgedSessionsWithDestCache()->dropOperation(opState->operationId);
}
- void visitConnectBridgedSessionsWithDestinationOpWaitLookupState(const ::AsteriskSCF::BasicRoutingService::V1::ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr& opState)
+ void visitConnectBridgedSessionsWithDestinationOpWaitLookupState(const ::AsteriskSCF::BasicRoutingService::V1::ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr& )
{
// Removing the Start state for this operation will clean it up.
}
- void visitConnectBridgedSessionsWithDestinationOpBridgingState(const ::AsteriskSCF::BasicRoutingService::V1::ConnectBridgedSessionsWithDestinationOpBridgingStatePtr& opState)
+ void visitConnectBridgedSessionsWithDestinationOpBridgingState(const ::AsteriskSCF::BasicRoutingService::V1::ConnectBridgedSessionsWithDestinationOpBridgingStatePtr& )
{
// Removing the Start state for this operation will clean it up.
}
@@ -106,11 +106,11 @@ public:
for (RoutingStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
{
- (*item)->visit(v);
+ (*item)->visit(v);
}
}
- void stateRemoved(const Ice::StringSeq& itemKeys, const Ice::Current& current)
+ void stateRemoved(const Ice::StringSeq& , const Ice::Current& )
{
lg(Error) << "Routing Service does not use key-based removes for state replication.";
}
@@ -119,16 +119,16 @@ public:
{
// Method-local visitor class for handling new state.
- class visitor : public AsteriskSCF::BasicRoutingService::V1::RoutingStateItemVisitor
- {
- public:
- visitor(RoutingStateReplicatorListenerPriv *impl, const Ice::Current& current)
- : mImpl(impl), mCurrent(current)
- {
- }
+ class visitor : public AsteriskSCF::BasicRoutingService::V1::RoutingStateItemVisitor
+ {
+ public:
+ visitor(RoutingStateReplicatorListenerPriv *impl, const Ice::Current& cur)
+ : mImpl(impl), mCurrent(cur)
+ {
+ }
- private:
- RoutingStateReplicatorListenerPriv *mImpl;
+ private:
+ RoutingStateReplicatorListenerPriv *mImpl;
const Ice::Current& mCurrent;
void visitRouteSessionOpStart(const ::AsteriskSCF::BasicRoutingService::V1::RouteSessionOpStartPtr& opState)
@@ -173,7 +173,7 @@ public:
for (RoutingStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
{
- (*item)->visit(v);
+ (*item)->visit(v);
}
}
diff --git a/src/SessionListener.cpp b/src/SessionListener.cpp
index ee8ec21..0b753de 100644
--- a/src/SessionListener.cpp
+++ b/src/SessionListener.cpp
@@ -28,7 +28,7 @@ using namespace AsteriskSCF::System::Logging;
namespace
{
-Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+Logger lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
}
namespace AsteriskSCF
@@ -111,7 +111,7 @@ void SessionListenerImpl::addSessionAndListen(SessionPrx session)
}
}
-const int SessionListenerImpl::getNumSessions()
+size_t SessionListenerImpl::getNumSessions()
{
boost::shared_lock<boost::shared_mutex> lock(mSessionLock);
return mSessions.size();
diff --git a/src/SessionListener.h b/src/SessionListener.h
index 31b1997..2f749cb 100644
--- a/src/SessionListener.h
+++ b/src/SessionListener.h
@@ -54,8 +54,8 @@ public: // Impl operations
* Add a session to be tracked by this listener, and attach this listener to the session.
*/
void addSessionAndListen(AsteriskSCF::SessionCommunications::V1::SessionPrx session);
- const int getNumSessions();
- bool isTerminated() ;
+ size_t getNumSessions();
+ bool isTerminated();
/**
* Stop listening to all sessions we're monitoring.
diff --git a/src/SessionRouterOperation.cpp b/src/SessionRouterOperation.cpp
index ef8fd66..e0432eb 100644
--- a/src/SessionRouterOperation.cpp
+++ b/src/SessionRouterOperation.cpp
@@ -16,6 +16,8 @@
#include <boost/shared_ptr.hpp>
+#include <AsteriskSCF/logger.h>
+
#include "SessionRouterOperation.h"
using namespace AsteriskSCF;
@@ -25,7 +27,7 @@ using namespace AsteriskSCF::System::Logging;
namespace
{
-Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+Logger lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
}
namespace AsteriskSCF
@@ -45,12 +47,12 @@ public:
* @param maxRetries Maximum number of times to retry.
* @intervalInMilliseconds Will sleep this amount in the retry() method.
*/
- RetryPolicy(size_t maxRetries, size_t intervalInMilliseconds) :
- mMaxRetries(maxRetries),
- mRetryIntervalMilliseconds(intervalInMilliseconds),
+ RetryPolicy(size_t maxRetriesIn, size_t intervalInMillisecondsIn) :
+ mMaxRetries(maxRetriesIn),
+ mRetryIntervalMilliseconds(intervalInMillisecondsIn),
mCounter(0)
{
- assert(maxRetries < 0xffff);
+ assert(maxRetriesIn < 0xffff);
}
/**
diff --git a/src/SessionRouterOperation.h b/src/SessionRouterOperation.h
index 7bc8212..63b81cc 100644
--- a/src/SessionRouterOperation.h
+++ b/src/SessionRouterOperation.h
@@ -47,16 +47,16 @@ public:
* Constructor. The BridgeManager and StateReplicator aren't initialized. They're configured
* later via a setter due to component initialization sequence.
*/
- SessionContext(const Ice::ObjectAdapterPtr& adapter,
- const EndpointRegistryPtr& registry,
- const AsteriskSCF::Core::Routing::V1::Event::RoutingEventsPtr& publisher,
- const boost::shared_ptr<AsteriskSCF::Threading::WorkQueue>& workQueue,
- const ReplicationContextPtr& replicationContext)
- : adapter(adapter),
- endpointRegistry(registry),
- eventPublisher(publisher),
- workQueue(workQueue),
- replicationContext(replicationContext)
+ SessionContext(const Ice::ObjectAdapterPtr& adapterArg,
+ const EndpointRegistryPtr& registryArg,
+ const AsteriskSCF::Core::Routing::V1::Event::RoutingEventsPtr& publisherArg,
+ const boost::shared_ptr<AsteriskSCF::Threading::WorkQueue>& workQueueArg,
+ const ReplicationContextPtr& replicationContextArg)
+ : adapter(adapterArg),
+ endpointRegistry(registryArg),
+ eventPublisher(publisherArg),
+ workQueue(workQueueArg),
+ replicationContext(replicationContextArg)
{
}
@@ -139,8 +139,8 @@ public:
*/
SessionRouterOperation(const SessionContextPtr& context,
S defaultState)
- : mFinished(false),
- mSessionContext(context),
+ : mSessionContext(context),
+ mFinished(false),
mStateMachine(defaultState)
{
}
@@ -319,12 +319,10 @@ public:
LookupCallback(SessionRouterOperation<T, S>* operation)
: mOperation(operation)
{
- lg(Debug) << "LookupCallback created.";
}
~LookupCallback()
{
- lg(Debug) << "LookupCallback destroyed.";
}
public: // Overrides.
-----------------------------------------------------------------------
--
asterisk-scf/integration/routing.git
More information about the asterisk-scf-commits
mailing list