[svn-commits] mmichelson: branch 1.6.0 r134760 - in /branches/1.6.0: ./ apps/app_queue.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 31 11:07:15 CDT 2008


Author: mmichelson
Date: Thu Jul 31 11:07:14 2008
New Revision: 134760

URL: http://svn.digium.com/view/asterisk?view=rev&rev=134760
Log:
Merged revisions 134759 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r134759 | mmichelson | 2008-07-31 11:05:12 -0500 (Thu, 31 Jul 2008) | 24 lines

Merged revisions 134758 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r134758 | mmichelson | 2008-07-31 10:56:18 -0500 (Thu, 31 Jul 2008) | 16 lines

Add more timeout checks into app_queue, specifically
targeting areas where an unknown and potentially
long time has just elapsed. Also added a check
to try_calling() to return early if the timeout
has elapsed instead of potentially setting a negative
timeout for the call (thus making it have *no* timeout
at all).


(closes issue #13186)
Reported by: miquel_cabrespina
Patches:
      13186.diff uploaded by putnopvut (license 60)
Tested by: miquel_cabrespina


........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_queue.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_queue.c?view=diff&rev=134760&r1=134759&r2=134760
==============================================================================
--- branches/1.6.0/apps/app_queue.c (original)
+++ branches/1.6.0/apps/app_queue.c Thu Jul 31 11:07:14 2008
@@ -2842,6 +2842,12 @@
 			(res = say_position(qe,ringing)))
 			break;
 
+		/* If we have timed out, break out */
+		if (qe->expire && (time(NULL) > qe->expire)) {
+			*reason = QUEUE_TIMEOUT;
+			break;
+		}
+
 		/* Make a periodic announcement, if enabled */
 		if (qe->parent->periodicannouncefrequency &&
 			(res = say_periodic_announcement(qe,ringing)))
@@ -2852,12 +2858,24 @@
 			update_qe_rule(qe);
 		}
 
+		/* If we have timed out, break out */
+		if (qe->expire && (time(NULL) > qe->expire)) {
+			*reason = QUEUE_TIMEOUT;
+			break;
+		}
+		
 		/* Wait a second before checking again */
 		if ((res = ast_waitfordigit(qe->chan, RECHECK * 1000))) {
 			if (res > 0 && !valid_exit(qe, res))
 				res = 0;
 			else
 				break;
+		}
+		
+		/* If we have timed out, break out */
+		if (qe->expire && (time(NULL) > qe->expire)) {
+			*reason = QUEUE_TIMEOUT;
+			break;
 		}
 	}
 
@@ -3175,6 +3193,15 @@
 	tmpid[0] = 0;
 	meid[0] = 0;
 	time(&now);
+
+	/* If we've already exceeded our timeout, then just stop
+	 * This should be extremely rare. queue_exec will take care
+	 * of removing the caller and reporting the timeout as the reason.
+	 */
+	if (qe->expire && now > qe->expire) {
+		res = 0;
+		goto out;
+	}
 		
 	for (; options && *options; options++)
 		switch (*options) {
@@ -4629,6 +4656,15 @@
 		if (qe.parent->periodicannouncefrequency)
 			if ((res = say_periodic_announcement(&qe,ringing)))
 				goto stop;
+	
+		/* Leave if we have exceeded our queuetimeout */
+		if (qe.expire && (time(NULL) > qe.expire)) {
+			record_abandoned(&qe);
+			reason = QUEUE_TIMEOUT;
+			res = 0;
+			ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
+			break;
+		}
 
 		/* see if we need to move to the next penalty level for this queue */
 		while (qe.pr && ((time(NULL) - qe.start) > qe.pr->time)) {
@@ -4688,7 +4724,6 @@
 
 		/* If using dynamic realtime members, we should regenerate the member list for this queue */
 		update_realtime_members(qe.parent);
-
 		/* OK, we didn't get anybody; wait for 'retry' seconds; may get a digit to exit with */
 		res = wait_a_bit(&qe);
 		if (res)




More information about the svn-commits mailing list