[asterisk-commits] mmichelson: branch 1.4 r134758 - /branches/1.4/apps/app_queue.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 31 10:56:19 CDT 2008
Author: mmichelson
Date: Thu Jul 31 10:56:18 2008
New Revision: 134758
URL: http://svn.digium.com/view/asterisk?view=rev&rev=134758
Log:
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.4/apps/app_queue.c
Modified: branches/1.4/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_queue.c?view=diff&rev=134758&r1=134757&r2=134758
==============================================================================
--- branches/1.4/apps/app_queue.c (original)
+++ branches/1.4/apps/app_queue.c Thu Jul 31 10:56:18 2008
@@ -2452,17 +2452,35 @@
(res = say_position(qe)))
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 && !ringing &&
(res = say_periodic_announcement(qe)))
break;
+ /* 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;
}
}
@@ -2700,6 +2718,15 @@
memset(&bridge_config, 0, sizeof(bridge_config));
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) {
@@ -3929,11 +3956,27 @@
}
makeannouncement = 1;
+ /* 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;
+ }
/* Make a periodic announcement, if enabled */
if (qe.parent->periodicannouncefrequency && !ringing)
if ((res = say_periodic_announcement(&qe)))
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;
+ }
/* Try calling all queue members for 'timeout' seconds */
res = try_calling(&qe, args.options, args.announceoverride, args.url, &tries, &noption, args.agi);
if (res)
@@ -3986,7 +4029,6 @@
res = wait_a_bit(&qe);
if (res)
goto stop;
-
/* Since this is a priority queue and
* it is not sure that we are still at the head
More information about the asterisk-commits
mailing list