[asterisk-commits] jrose: branch jrose/call_identifiers r360779 - in /team/jrose/call_identifier...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 29 13:43:30 CDT 2012


Author: jrose
Date: Thu Mar 29 13:43:26 2012
New Revision: 360779

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=360779
Log:
Mark's Mar 29 review changes

Modified:
    team/jrose/call_identifiers/include/asterisk/logger.h
    team/jrose/call_identifiers/main/bridging.c
    team/jrose/call_identifiers/main/features.c

Modified: team/jrose/call_identifiers/include/asterisk/logger.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/call_identifiers/include/asterisk/logger.h?view=diff&rev=360779&r1=360778&r2=360779
==============================================================================
--- team/jrose/call_identifiers/include/asterisk/logger.h (original)
+++ team/jrose/call_identifiers/include/asterisk/logger.h Thu Mar 29 13:43:26 2012
@@ -246,7 +246,7 @@
 /*!
  * \brief extracts the callerid from the thread
  *
- * \revtal ast_callid reference to call_id related to the thread
+ * \retval ast_callid reference to call_id related to the thread
  * \retval NULL if no call_id is present in the thread
  *
  * This reference must be unreffed before it loses scope to prevent memory leaks.

Modified: team/jrose/call_identifiers/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/call_identifiers/main/bridging.c?view=diff&rev=360779&r1=360778&r2=360779
==============================================================================
--- team/jrose/call_identifiers/main/bridging.c (original)
+++ team/jrose/call_identifiers/main/bridging.c Thu Mar 29 13:43:26 2012
@@ -372,10 +372,6 @@
 
 	ao2_lock(bridge);
 
-	if (bridge->callid) {
-		ast_callid_threadassoc_add(bridge->callid);
-	}
-
 	ast_debug(1, "Started bridge thread for %p\n", bridge);
 
 	/* Loop around until we are told to stop */
@@ -545,10 +541,6 @@
 	/* Drop every bridged channel, the last one will cause the bridge thread (if it exists) to exit */
 	AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) {
 		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
-	}
-
-	if (bridge->callid) {
-		ast_callid_unref(bridge->callid);
 	}
 
 	ao2_unlock(bridge);
@@ -979,10 +971,6 @@
 		/* If the technology requires a thread and one is not running, start it up */
 		if (bridge_channel->bridge->thread == AST_PTHREADT_NULL && (bridge_channel->bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_THREAD)) {
 			bridge_channel->bridge->stop = 0;
-
-			/* callid must be unreffed once it is no longer in use */
-			bridge_channel->bridge->callid = ast_read_threadstorage_callid();
-
 			ast_debug(1, "Starting a bridge thread for bridge %p\n", bridge_channel->bridge);
 			ao2_ref(bridge_channel->bridge, +1);
 			if (ast_pthread_create(&bridge_channel->bridge->thread, NULL, bridge_thread, bridge_channel->bridge)) {
@@ -1071,11 +1059,6 @@
 		ao2_ref(bridge_channel->bridge, -1);
 		bridge_channel->bridge = NULL;
 	}
-
-	if (bridge_channel->callid) {
-		ast_callid_unref(bridge_channel->callid);
-	}
-
 	/* Destroy elements of the bridge channel structure and the bridge channel structure itself */
 	ast_cond_destroy(&bridge_channel->cond);
 }
@@ -1135,10 +1118,6 @@
 	struct ast_bridge_channel *bridge_channel = data;
 	enum ast_bridge_channel_state state;
 
-	if (bridge_channel->callid) {
-		ast_callid_threadassoc_add(bridge_channel->callid);
-	}
-
 	state = bridge_channel_join(bridge_channel);
 
 	/* If no other thread is going to take the channel then hang it up, or else we would have to service it until something else came along */
@@ -1171,9 +1150,6 @@
 	bridge_channel->swap = swap;
 	bridge_channel->features = features;
 	bridge_channel->allow_impart_hangup = allow_hangup;
-
-	/* callid must be unreffed when it is no longer in use */
-	bridge_channel->callid = ast_read_threadstorage_callid();
 
 	/* Actually create the thread that will handle the channel */
 	if (ast_pthread_create(&bridge_channel->thread, NULL, bridge_channel_thread, bridge_channel)) {

Modified: team/jrose/call_identifiers/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/call_identifiers/main/features.c?view=diff&rev=360779&r1=360778&r2=360779
==============================================================================
--- team/jrose/call_identifiers/main/features.c (original)
+++ team/jrose/call_identifiers/main/features.c Thu Mar 29 13:43:26 2012
@@ -1005,7 +1005,12 @@
 
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-	ast_pthread_create(&thread, &attr, bridge_call_thread, data);
+	if (ast_pthread_create(&thread, &attr, bridge_call_thread, data)) {
+		/* Failed to create thread. Ditch the reference to callid. */
+		ast_callid_unref(data->callid);
+		ast_log(LOG_ERROR, "Failed to create bridge_call_thread.\n");
+		return;
+	}
 	pthread_attr_destroy(&attr);
 	memset(&sched, 0, sizeof(sched));
 	pthread_setschedparam(thread, SCHED_RR, &sched);




More information about the asterisk-commits mailing list