[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "basecomponent" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Jul 20 10:15:55 CDT 2011
branch "basecomponent" has been updated
via 5fa06b19fa21ccb12d626a86f34bb959597cff52 (commit)
via 24346648f5d24daa95d4fc4aa78cd510419522e4 (commit)
from 61b4accfa3b8fd620ab29559f64d972bd5474766 (commit)
Summary of changes:
src/Component.cpp | 68 ++++++++++++++--------------------------
src/RtpStateReplicatorApp.cpp | 22 ++++++------
test/TestRTPpjmedia.cpp | 2 +-
3 files changed, 36 insertions(+), 56 deletions(-)
- Log -----------------------------------------------------------------
commit 5fa06b19fa21ccb12d626a86f34bb959597cff52
Author: Ken Hunt <ken.hunt at digium.com>
Date: Wed Jul 20 10:15:26 2011 -0500
Using simpler registration wrapper helper interface.
diff --git a/src/Component.cpp b/src/Component.cpp
index 73da34d..8fc7691 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -349,14 +349,9 @@ void Component::prepareBackplaneServicesForDiscovery()
try
{
- std::string serviceName = getCommunicator()->getProperties()->getPropertyWithDefault(
- getName() + ".Service", "default");
-
// Register our configuration interface with the Service Locator.
mConfigurationRegistration = wrapServiceForRegistration(mConfigurationServicePrx,
- ConfigurationDiscoveryCategory,
- serviceName,
- getName());
+ ConfigurationDiscoveryCategory);
manageBackplaneService(mConfigurationRegistration);
}
catch(const std::exception& e)
@@ -489,13 +484,8 @@ void Component::preparePrimaryServicesForDiscovery()
{
try
{
- std::string serviceName = getCommunicator()->getProperties()->getPropertyWithDefault(
- getName() + ".Service", "default");
-
mRtpMediaServiceRegistration = wrapServiceForRegistration(mRtpMediaServicePrx,
- "rtp",
- serviceName,
- getName());
+ "rtp");
managePrimaryService(mRtpMediaServiceRegistration);
}
catch(const std::exception& e)
commit 24346648f5d24daa95d4fc4aa78cd510419522e4
Author: Ken Hunt <ken.hunt at digium.com>
Date: Tue Jul 19 16:56:58 2011 -0500
More updates from testing.
diff --git a/src/Component.cpp b/src/Component.cpp
index 82ec722..73da34d 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -128,23 +128,22 @@ public:
private:
// Required base Component overrides
virtual void createPrimaryServices();
- virtual void registerPrimaryServices();
+ virtual void preparePrimaryServicesForDiscovery();
virtual void createReplicationStateListeners();
virtual void stopListeningToStateReplicators();
virtual void listenToStateReplicators();
virtual void findRemoteServices();
+ virtual void onRegisterPrimaryServices();
// Optional base Component notifcation overrides
virtual void onSuspend();
virtual void onResume();
virtual void onPreInitialize();
- virtual void onActivated();
- virtual void onStandby();
virtual void onStop();
virtual void onStart();
// Other base Component overrides
- virtual void registerBackplaneServices();
+ virtual void prepareBackplaneServicesForDiscovery();
ReplicationContextPtr createReplicationContext(ReplicationStateType state);
// A proxy to the service locator manager for the component service.
@@ -314,7 +313,7 @@ void Component::createPrimaryServices()
static_pointer_cast<RtpReplicationContext>(getReplicationContext());
mConfigurationService = new ConfigurationServiceImpl();
- ConfigurationServicePrx mConfigurationServiceProxy = ConfigurationServicePrx::uncheckedCast(
+ mConfigurationServicePrx = ConfigurationServicePrx::uncheckedCast(
getServiceAdapter()->addWithUUID(mConfigurationService));
mRtpMediaServicePtr =
@@ -340,13 +339,13 @@ void Component::createPrimaryServices()
}
/**
- * Register this component's backplane interfaces with the Service Locator.
+ * Prepare this component's backplane interfaces for the Service Locator.
* This enables other Asterisk SCF components to locate our interfaces.
*/
-void Component::registerBackplaneServices()
+void Component::prepareBackplaneServicesForDiscovery()
{
- // Insure the default Component services are registered.
- Component::registerBackplaneServices();
+ // Insure the default Component services are prepped.
+ AsteriskSCF::Component::Component::prepareBackplaneServicesForDiscovery();
try
{
@@ -358,7 +357,7 @@ void Component::registerBackplaneServices()
ConfigurationDiscoveryCategory,
serviceName,
getName());
- bool registered = manageBackplaneService(mConfigurationRegistration);
+ manageBackplaneService(mConfigurationRegistration);
}
catch(const std::exception& e)
{
@@ -394,9 +393,9 @@ void Component::findRemoteServices()
configurationReplicator->registerConfigurationService(mConfigurationServicePrx);
}
- catch (...)
+ catch (const std::exception& e)
{
- lg(Error) << "State replicator could not be found, operating without.";
+ lg(Error) << getName() << ": " << BOOST_CURRENT_FUNCTION << " State replicator could not be found, operating without. " << e.what();
}
}
@@ -442,7 +441,7 @@ void Component::listenToStateReplicators()
try
{
// Are we in standby mode?
- if (rtpReplicationContext->getState() == ACTIVE_IN_REPLICA_GROUP)
+ if (rtpReplicationContext->getState() == STANDBY_IN_REPLICA_GROUP)
{
rtpReplicationContext->getReplicator()->addListener(mReplicatorListenerProxy);
mListeningToReplicator = true;
@@ -483,11 +482,10 @@ void Component::stopListeningToStateReplicators()
}
/**
- * Register this component's primary public interfaces with the Service Locator.
+ * Prepares this component's primary public interfaces for discovery via the Service Locator.
* This enables other Asterisk SCF components to locate the interfaces we are publishing.
- *
*/
-void Component::registerPrimaryServices()
+void Component::preparePrimaryServicesForDiscovery()
{
try
{
@@ -498,7 +496,7 @@ void Component::registerPrimaryServices()
"rtp",
serviceName,
getName());
- bool registered = managePrimaryService(mRtpMediaServiceRegistration);
+ managePrimaryService(mRtpMediaServiceRegistration);
}
catch(const std::exception& e)
{
@@ -508,28 +506,20 @@ void Component::registerPrimaryServices()
}
}
-/**
- * These overrides will be needed. I don't think this component
- * handled this well in the past. It simply checked if it was active/standby
- * during startup.
- */
-void Component::onActivated()
+void Component::onRegisterPrimaryServices()
{
-}
+ if (getReplicationContext()->isActive() == false)
+ {
+ return;
+ }
-/**
- * These overrides will be needed. I don't think this component
- * handled this well in the past. It simply checked if it was active/standby
- * during startup.
- */
-void Component::onStandby()
-{
+ mGeneralState->mServiceManagement = mRtpMediaServiceRegistration->getServiceMangement();
}
void Component::onStart()
{
// Note: I don't think this is necessary. If we make the
- // id computed from a "service" identifier (which could default
+ // comparator computed from a "service" identifier (which could default
// to "default", there's nothing replicated here that the standby component
// couldn't already determine itself.
if (getReplicationContext()->isReplicating() == true)
diff --git a/src/RtpStateReplicatorApp.cpp b/src/RtpStateReplicatorApp.cpp
index 3d93864..e5a8675 100644
--- a/src/RtpStateReplicatorApp.cpp
+++ b/src/RtpStateReplicatorApp.cpp
@@ -123,18 +123,18 @@ void ConfigurationReplicatorI::registerConfigurationService(const AsteriskSCF::S
{
if (mConfigurationReplicationTopic)
{
- IceStorm::QoS qos;
- qos["reliability"] = "ordered";
+ IceStorm::QoS qos;
+ qos["reliability"] = "ordered";
- try
- {
- mConfigurationReplicationTopic->subscribeAndGetPublisher(qos, service);
- }
- catch (const IceStorm::AlreadySubscribed&)
- {
- // This is perfectly okay actually, it just means what they wanted us to do
- // is already done.
- }
+ try
+ {
+ mConfigurationReplicationTopic->subscribeAndGetPublisher(qos, service);
+ }
+ catch (const IceStorm::AlreadySubscribed&)
+ {
+ // This is perfectly okay actually, it just means what they wanted us to do
+ // is already done.
+ }
}
}
diff --git a/test/TestRTPpjmedia.cpp b/test/TestRTPpjmedia.cpp
index dae217f..1a52116 100644
--- a/test/TestRTPpjmedia.cpp
+++ b/test/TestRTPpjmedia.cpp
@@ -401,7 +401,7 @@ BOOST_AUTO_TEST_CASE(CheckReplicatedGeneralStateItem)
if (!Testbed.mListener->mGeneral)
{
- Testbed.mCondition.wait(lock);
+ Testbed.mCondition.wait(lock);
}
BOOST_CHECK(Testbed.mListener->mGeneral);
-----------------------------------------------------------------------
--
asterisk-scf/integration/media_rtp_pjmedia.git
More information about the asterisk-scf-commits
mailing list