summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2003-08-09 19:04:03 +0000
committerMark Spencer <markster@digium.com>2003-08-09 19:04:03 +0000
commit51b800f40a664581ab3974ce5e1ebbf963b7669a (patch)
tree4e7155f44493b3b823bc292a7face62ec7a8dd2a /apps/app_queue.c
parentbe647641bba5c5ed89fc42f8291d18d3e01facb8 (diff)
Fix round robin scheduling
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1280 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_queue.c')
-rwxr-xr-xapps/app_queue.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index cddf31165..8417833a9 100755
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -632,18 +632,22 @@ static int calc_metric(struct ast_call_queue *q, struct member *mem, int pos, st
break;
case QUEUE_STRATEGY_ROUNDROBIN:
if (!pos) {
- /* rrpos > number of queue entries */
- if (!q->wrapped)
- q->rrpos = 1;
- else
+ if (!q->wrapped) {
+ /* No more channels, start over */
+ q->rrpos = 0;
+ } else {
+ /* Prioritize next entry */
q->rrpos++;
+ }
q->wrapped = 0;
}
if (pos < q->rrpos) {
tmp->metric = 1000 + pos;
} else {
- if (pos > q->rrpos)
+ if (pos > q->rrpos) {
+ /* Indicate there is another priority */
q->wrapped = 1;
+ }
tmp->metric = pos;
}
tmp->metric += mem->penalty * 1000000;