[Asterisk-cvs] asterisk/channels chan_h323.c,1.19,1.20

jeremy at lists.digium.com jeremy at lists.digium.com
Fri Jan 2 21:10:49 CST 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv16667

Modified Files:
	chan_h323.c 
Log Message:
clean up file descriptor leak and check for io before thread cancellation


Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- chan_h323.c	24 Dec 2003 22:38:24 -0000	1.19
+++ chan_h323.c	3 Jan 2004 03:02:27 -0000	1.20
@@ -487,10 +487,13 @@
 
 	/* Start the process if it's not already started */
 	if (!p->alreadygone) {
-		if (h323_clear_call((p->cd).call_token)) 
-			ast_log(LOG_DEBUG, "ClearCall failed.\n");
 		p->needdestroy = 1;
-	}
+	}	
+	
+       /* Tell the H.323 stack to cleanly tare down the call */
+       if (h323_clear_call((p->cd).call_token)) {
+               ast_log(LOG_DEBUG, "ClearCall failed.\n");
+       }
 
 	/* Update usage counter */
 	ast_mutex_lock(&usecnt_lock);
@@ -1236,13 +1239,15 @@
 		}
 		ast_mutex_unlock(&iflock);
 
-		pthread_testcancel();
-
 		/* Wait for sched or io */
 		res = ast_sched_wait(sched);
 		if ((res < 0) || (res > 1000))
 			res = 1000;
 		res = ast_io_wait(io, res);
+                
+		/* Check for thread cancellation */
+                pthread_testcancel();
+
 		ast_mutex_lock(&monlock);
 		if (res >= 0) 
 			ast_sched_runq(sched);




More information about the svn-commits mailing list