[svn-commits] file: branch 12 r404923 - /branches/12/res/res_pjsip_outbound_registration.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Jan 4 19:30:03 CST 2014


Author: file
Date: Sat Jan  4 19:29:56 2014
New Revision: 404923

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404923
Log:
res_pjsip_outbound_registration: Create registration client in pj thread.

Depending on which threading was loading the outbound registration it was
possible for the registration client to be allocated outside of a pj thread.
This change moves the creation inside the synchronous task where it is
guaranteed it will occur in a pj thread.

Reported by: Rob Thomas

Modified:
    branches/12/res/res_pjsip_outbound_registration.c

Modified: branches/12/res/res_pjsip_outbound_registration.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_outbound_registration.c?view=diff&rev=404923&r1=404922&r2=404923
==============================================================================
--- branches/12/res/res_pjsip_outbound_registration.c (original)
+++ branches/12/res/res_pjsip_outbound_registration.c Sat Jan  4 19:29:56 2014
@@ -542,10 +542,7 @@
 		return NULL;
 	}
 
-	if ((pjsip_regc_create(ast_sip_get_pjsip_endpoint(), state->client_state, sip_outbound_registration_response_cb, &state->client_state->client) != PJ_SUCCESS) ||
-		!(state->client_state->serializer = ast_sip_create_serializer())) {
-		/* This is on purpose, normal operation will have it be deallocated within the serializer */
-		pjsip_regc_destroy(state->client_state->client);
+	if (!(state->client_state->serializer = ast_sip_create_serializer())) {
 		ao2_cleanup(state->client_state);
 		ao2_cleanup(state);
 		return NULL;
@@ -726,6 +723,12 @@
 		} else {
 			return -1;
 		}
+	}
+
+	if (!registration->state->client_state->client &&
+		pjsip_regc_create(ast_sip_get_pjsip_endpoint(), registration->state->client_state, sip_outbound_registration_response_cb,
+		&registration->state->client_state->client) != PJ_SUCCESS) {
+		return -1;
 	}
 
 	pjsip_regc_set_transport(registration->state->client_state->client, &selector);




More information about the svn-commits mailing list