[asterisk-commits] mmichelson: branch mmichelson/timeout_fixes r374071 - /team/mmichelson/timeou...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 28 15:27:01 CDT 2012


Author: mmichelson
Date: Fri Sep 28 15:26:56 2012
New Revision: 374071

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=374071
Log:
Make final corrections to app_dial and app_queue.


Modified:
    team/mmichelson/timeout_fixes/apps/app_dial.c
    team/mmichelson/timeout_fixes/apps/app_queue.c

Modified: team/mmichelson/timeout_fixes/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/timeout_fixes/apps/app_dial.c?view=diff&rev=374071&r1=374070&r2=374071
==============================================================================
--- team/mmichelson/timeout_fixes/apps/app_dial.c (original)
+++ team/mmichelson/timeout_fixes/apps/app_dial.c Fri Sep 28 15:26:56 2012
@@ -1096,7 +1096,7 @@
 		ast_poll_channel_add(in, epollo->chan);
 #endif
 
-	while (*to && !peer) {
+	while ((ast_tvdiff_ms(ast_tvnow(), start) < orig || orig < 0) && !peer) {
 		struct chanlist *o;
 		int pos = 0; /* how many channels do we handle */
 		int numlines = prestart;
@@ -1628,10 +1628,14 @@
 skip_frame:;
 			ast_frfree(f);
 		}
-		if (!*to)
+		if (ast_remaining_ms(start, orig) == 0)
 			ast_verb(3, "Nobody picked up in %d ms\n", orig);
-		if (!*to || ast_check_hangup(in))
+		if (ast_remaining_ms(start, orig) == 0 || ast_check_hangup(in))
 			ast_cdr_noanswer(in->cdr);
+	}
+
+	if (orig > -1 && ast_tvdiff_ms(ast_tvnow(), start) <= 0) {
+		*to = 0;
 	}
 
 #ifdef HAVE_EPOLL

Modified: team/mmichelson/timeout_fixes/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/timeout_fixes/apps/app_queue.c?view=diff&rev=374071&r1=374070&r2=374071
==============================================================================
--- team/mmichelson/timeout_fixes/apps/app_queue.c (original)
+++ team/mmichelson/timeout_fixes/apps/app_queue.c Fri Sep 28 15:26:56 2012
@@ -3489,7 +3489,7 @@
 	}
 #endif
 	
-	while (*to && !peer) {
+	while ((ast_tvdiff_ms(ast_tvnow(), start_time_tv) < orig || orig < 0) && !peer) {
 		int numlines, retry, pos = 1;
 		struct ast_channel *watchers[AST_MAX_WATCHERS];
 		watchers[0] = in;
@@ -3747,9 +3747,9 @@
 							rna(endtime * 1000, qe, on, membername, 0);
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart)
-									*to = orig;
+									start_time_tv = ast_tvnow();
 								/* Have enough time for a queue member to answer? */
-								if (*to > 500) {
+								if (ast_remaining_ms(start_time_tv, orig) > 500) {
 									ring_one(qe, outgoing, &numbusies);
 									starttime = (long) time(NULL);
 								}
@@ -3766,8 +3766,8 @@
 							do_hang(o);
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart)
-									*to = orig;
-								if (*to > 500) {
+									start_time_tv = ast_tvnow();
+								if (ast_remaining_ms(start_time_tv, orig) > 500) {
 									ring_one(qe, outgoing, &numbusies);
 									starttime = (long) time(NULL);
 								}
@@ -3855,8 +3855,8 @@
 					do_hang(o);
 					if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 						if (qe->parent->timeoutrestart)
-							*to = orig;
-						if (*to > 500) {
+							start_time_tv = ast_tvnow();
+						if (ast_remaining_ms(start_time_tv, orig) > 500) {
 							ring_one(qe, outgoing, &numbusies);
 							starttime = (long) time(NULL);
 						}
@@ -3902,10 +3902,14 @@
 			}
 			ast_frfree(f);
 		}
-		if (!*to) {
+		if (ast_remaining_ms(start_time_tv, orig) <= 0) {
 			for (o = start; o; o = o->call_next)
 				rna(orig, qe, o->interface, o->member->membername, 1);
 		}
+	}
+	
+	if (orig > -1 && ast_tvdiff_ms(ast_tvnow(), start_time_tv)) {
+		*to = 0;
 	}
 
 #ifdef HAVE_EPOLL




More information about the asterisk-commits mailing list