[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r322605 - /team/irroot/distrot...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 9 09:21:49 CDT 2011


Author: irroot
Date: Thu Jun  9 09:21:45 2011
New Revision: 322605

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=322605
Log:
Penalty Function Is A MESS Fixup

Modified:
    team/irroot/distrotech-customers-1.8/apps/app_queue.c

Modified: team/irroot/distrotech-customers-1.8/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/apps/app_queue.c?view=diff&rev=322605&r1=322604&r2=322605
==============================================================================
--- team/irroot/distrotech-customers-1.8/apps/app_queue.c (original)
+++ team/irroot/distrotech-customers-1.8/apps/app_queue.c Thu Jun  9 09:21:45 2011
@@ -5435,40 +5435,34 @@
 	int foundinterface = 0, foundqueue = 0;
 	struct call_queue *q;
 	struct member *mem;
-	struct ao2_iterator queue_iter;
 	char rtpenalty[80];
 
-	if (penalty < 0) {
+	if (penalty < 0 && !negative_penalty_invalid) {
 		ast_log(LOG_ERROR, "Invalid penalty (%d)\n", penalty);
 		return RESULT_FAILURE;
 	}
 
-	queue_iter = ao2_iterator_init(queues, 0);
-	while ((q = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) {
+	if ((q = load_realtime_queue(queuename))) {
+		foundqueue++;
 		ao2_lock(q);
-		if (ast_strlen_zero(queuename) || !strcasecmp(q->name, queuename)) {
-			foundqueue++;
-			if ((mem = interface_exists(q, interface))) {
-				foundinterface++;
-				if (!mem->realtime) {
-					mem->penalty = penalty;
-				} else {
-					sprintf(rtpenalty,"%i", penalty);
-					update_realtime_member_field(mem, q->name, "penalty", rtpenalty);
-				}
-				ast_queue_log(q->name, "NONE", interface, "PENALTY", "%d", penalty);
-				manager_event(EVENT_FLAG_AGENT, "QueueMemberPenalty",
-					"Queue: %s\r\n"
-					"Location: %s\r\n"
-					"Penalty: %d\r\n",
-					q->name, mem->interface, penalty);
-				ao2_ref(mem, -1);
-			}
+		if ((mem = interface_exists(q, interface))) {
+			foundinterface++;
+			if (!mem->realtime) {
+				mem->penalty = penalty;
+			} else {
+				sprintf(rtpenalty,"%i", penalty);
+				update_realtime_member_field(mem, q->name, "penalty", rtpenalty);
+			}
+			ast_queue_log(q->name, "NONE", interface, "PENALTY", "%d", penalty);
+			manager_event(EVENT_FLAG_AGENT, "QueueMemberPenalty",
+				"Queue: %s\r\n"
+				"Location: %s\r\n"
+				"Penalty: %d\r\n",
+				q->name, mem->interface, penalty);
+			ao2_ref(mem, -1);
 		}
 		ao2_unlock(q);
-		queue_t_unref(q, "Done with iterator");
-	}
-	ao2_iterator_destroy(&queue_iter);
+	}
 
 	if (foundinterface) {
 		return RESULT_SUCCESS;




More information about the asterisk-commits mailing list