[asterisk-commits] jpeeler: trunk r218583 - /trunk/channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 15 11:12:53 CDT 2009


Author: jpeeler
Date: Tue Sep 15 11:12:49 2009
New Revision: 218583

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=218583
Log:
Add some changes related to 218430.

* Remove thread_spawned in handle_init_event since it was never used
* Always check handle_init_event in case a channel is destroyed

Modified:
    trunk/channels/chan_dahdi.c

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=218583&r1=218582&r2=218583
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Tue Sep 15 11:12:49 2009
@@ -9922,7 +9922,6 @@
 static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
 {
 	int res;
-	int thread_spawned = 0;
 	pthread_t threadid;
 	struct ast_channel *chan;
 
@@ -9976,8 +9975,6 @@
 						if (res < 0)
 							ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
 						ast_hangup(chan);
-					} else {
-						thread_spawned = 1;
 					}
 				} else
 					ast_log(LOG_WARNING, "Unable to create channel\n");
@@ -10019,8 +10016,6 @@
 					ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
 				}
 				ast_hangup(chan);
-			} else {
-				thread_spawned = 1;
 			}
 			break;
 		default:
@@ -10109,8 +10104,6 @@
 					ast_log(LOG_WARNING, "Cannot allocate new structure on channel %d\n", i->channel);
 				} else if (ast_pthread_create_detached(&threadid, NULL, analog_ss_thread, chan)) {
 					ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
-				} else {
-					thread_spawned = 1;
 				}
 			}
 			break;
@@ -10363,7 +10356,8 @@
 									struct ast_channel *chan;
 									ast_mutex_unlock(&iflock);
 									if (analog_lib_handles(i->sig, i->radio, i->oprmode)) {
-										analog_handle_init_event(i->sig_pvt, ANALOG_EVENT_DTMFCID);  
+										/* just in case this event changes or somehow destroys a channel, set doomed here too */
+										doomed = analog_handle_init_event(i->sig_pvt, ANALOG_EVENT_DTMFCID);  
 										i->dtmfcid_holdoff_state = 1;
 									} else {
 										chan = dahdi_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0, NULL);




More information about the asterisk-commits mailing list