[asterisk-commits] file: branch 1.4 r48478 - /branches/1.4/channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Dec 14 23:28:06 MST 2006


Author: file
Date: Fri Dec 15 00:28:05 2006
New Revision: 48478

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48478
Log:
Use a wakeup variable so that we don't wait on IO indefinitely if packets need to be retransmitted.

Modified:
    branches/1.4/channels/chan_iax2.c

Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=48478&r1=48477&r2=48478
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Fri Dec 15 00:28:05 2006
@@ -8009,7 +8009,7 @@
 {
 	/* Our job is simple: Send queued messages, retrying if necessary.  Read frames 
 	   from the network, and queue them for delivery to the channels */
-	int res, count;
+	int res, count, wakeup;
 	struct iax_frame *f;
 
 	if (timingfd > -1)
@@ -8020,13 +8020,16 @@
 		   sent, and scheduling retransmissions if appropriate */
 		AST_LIST_LOCK(&iaxq.queue);
 		count = 0;
+		wakeup = -1;
 		AST_LIST_TRAVERSE_SAFE_BEGIN(&iaxq.queue, f, list) {
 			if (f->sentyet)
 				continue;
 			
 			/* Try to lock the pvt, if we can't... don't fret - defer it till later */
-			if (ast_mutex_trylock(&iaxsl[f->callno]))
+			if (ast_mutex_trylock(&iaxsl[f->callno])) {
+				wakeup = 1;
 				continue;
+			}
 
 			f->sentyet++;
 
@@ -8057,7 +8060,7 @@
 			ast_log(LOG_DEBUG, "chan_iax2: Sent %d queued outbound frames all at once\n", count);
 
 		/* Now do the IO, and run scheduled tasks */
-		res = ast_io_wait(io, -1);
+		res = ast_io_wait(io, wakeup);
 		if (res >= 0) {
 			if (res >= 20)
 				ast_log(LOG_DEBUG, "chan_iax2: ast_io_wait ran %d I/Os all at once\n", res);



More information about the asterisk-commits mailing list