[asterisk-commits] mmichelson: branch mmichelson/queue-penalty r93740 - /team/mmichelson/queue-p...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 18 14:47:33 CST 2007


Author: mmichelson
Date: Tue Dec 18 14:47:33 2007
New Revision: 93740

URL: http://svn.digium.com/view/asterisk?view=rev&rev=93740
Log:
Logic error regarding calculation of time fixed. Added a temporary debug message to show what the max penalty was changed to


Modified:
    team/mmichelson/queue-penalty/apps/app_queue.c

Modified: team/mmichelson/queue-penalty/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-penalty/apps/app_queue.c?view=diff&rev=93740&r1=93739&r2=93740
==============================================================================
--- team/mmichelson/queue-penalty/apps/app_queue.c (original)
+++ team/mmichelson/queue-penalty/apps/app_queue.c Tue Dec 18 14:47:33 2007
@@ -2624,7 +2624,7 @@
 			break;
 		
 		/* see if we need to move to the next penalty level for this queue */
-		if (qe->pr && (time(NULL) > (qe->pr->time - qe->start))) {
+		if (qe->pr && ((time(NULL) - qe->start) > qe->pr->time)) {
 			int max_penalty = qe->pr->relative ? qe->max_penalty + qe->pr->value : qe->pr->value;
 			char max_penalty_str[12]; /*XXX Will change this idiom and probably optimize things once everything is running */
 			snprintf(max_penalty_str, sizeof(max_penalty_str) - 1, "%d", max_penalty);
@@ -4220,13 +4220,14 @@
 			}
 
 			/* see if we need to move to the next penalty level for this queue */
-			if (qe.pr && (time(NULL) > (qe.pr->time - qe.start))) {
+			if (qe.pr && ((time(NULL) - qe.start) > qe.pr->time)) {
 				char max_penalty_str[12]; /*XXX Will change this idiom and probably optimize things once everything is running */
 				max_penalty = qe.pr->relative ? qe.max_penalty + qe.pr->value : qe.pr->value;
 				snprintf(max_penalty_str, sizeof(max_penalty_str) - 1, "%d", max_penalty);
 				AST_LIST_LOCK(&qe.parent->rules);
 				pbx_builtin_setvar_helper(qe.chan, "QUEUE_MAX_PENALTY", max_penalty_str);
 				qe.max_penalty = max_penalty;
+				ast_log(LOG_DEBUG, "Changed the max penalty for caller %s to %d\n", qe.chan->name, qe.max_penalty);
 				qe.pr = AST_LIST_NEXT(qe.pr, list);
 				AST_LIST_UNLOCK(&qe.parent->rules);
 			}




More information about the asterisk-commits mailing list