[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Sep 13 08:55:15 CDT 2010


branch "master" has been updated
       via  17a088ed09e3ce208e46f4d496357a3458e65fec (commit)
      from  7b76891d093e4b14225d71031023a1c864973ffd (commit)

Summary of changes:
 src/MediaRTPpjmedia.cpp |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)


- Log -----------------------------------------------------------------
commit 17a088ed09e3ce208e46f4d496357a3458e65fec
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 13 11:01:43 2010 -0300

    Fix a bug where shutting down media_rtp_pjmedia may or may not have unregistered it from the service locator depending on how far the communicator had shutdown.

diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 177ac91..34419a8 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -61,6 +61,15 @@ public:
 	void interruptCallback(int);
 
 private:
+	/**
+	 * A proxy to the service locator manager for the RTP media service.
+	 */
+	ServiceManagementPrx mServiceManagement;
+
+	/**
+	 * A proxy to the service locator manager for the component service.
+	 */
+	ServiceManagementPrx mComponentServiceManagement;
 };
 
 /**
@@ -203,6 +212,8 @@ RTPSessionPrx RTPMediaServiceImpl::allocate(const FormatSeq& formats, const Ice:
  */
 int MediaRTPpjmediaApp::run(int argc, char* argv[])
 {
+	callbackOnInterrupt();
+
 	/* Initialize pjlib as pjmedia will be using it */
 	pj_status_t status = pj_init();
 	if (status != PJ_SUCCESS)
@@ -231,33 +242,32 @@ int MediaRTPpjmediaApp::run(int argc, char* argv[])
 
 	ServiceLocatorManagementPrx management = ServiceLocatorManagementPrx::checkedCast(communicator()->propertyToProxy("ServiceLocatorManagementProxy"));
 
-	ServiceManagementPrx service_management = ServiceManagementPrx::uncheckedCast(management->addService(RTPMediaServiceProxy, "media_rtp_pjmedia"));
+	mServiceManagement = ServiceManagementPrx::uncheckedCast(management->addService(RTPMediaServiceProxy, "media_rtp_pjmedia"));
 
 	/* One must provide a component service to manage us, if someone wants to */
-	ComponentServicePtr ComponentService = new ComponentServiceImpl(*this, service_management);
+	ComponentServicePtr ComponentService = new ComponentServiceImpl(*this, mServiceManagement);
 	ComponentServicePrx ComponentServiceProxy = ComponentServicePrx::uncheckedCast(adapter->addWithUUID(ComponentService));
 
 	/* Let's add the component service to the service locator first */
-	ServiceManagementPrx component_service_management = ServiceManagementPrx::uncheckedCast(management->addService(ComponentServiceProxy, "media_rtp_pjmedia"));
+	mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(management->addService(ComponentServiceProxy, "media_rtp_pjmedia"));
 	ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
 	genericparams->category = "Component/media_rtp_pjmedia";
-	component_service_management->addLocatorParams(genericparams, "");
+	mComponentServiceManagement->addLocatorParams(genericparams, "");
 
 	/* Now we can add some parameters to help find us. */
 	genericparams->category = "rtp";
-	service_management->addLocatorParams(genericparams, "");
+	mServiceManagement->addLocatorParams(genericparams, "");
 
 	/* Welp we are now in the service locator... they can find us! */
 	communicator()->waitForShutdown();
 
-	/* When all is said and done we have to leave the party */
-	component_service_management->unregister();
-	service_management->unregister();
-
 	return EXIT_SUCCESS;
 }
 
 void MediaRTPpjmediaApp::interruptCallback(int val)
 {
-	_exit(EXIT_SUCCESS);
+   mComponentServiceManagement->unregister();
+   mServiceManagement->unregister();
+   communicator()->shutdown();
+   _exit(EXIT_SUCCESS);
 }

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list