aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-11 16:05:56 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-11 16:05:56 +0000
commit818abf342bed5d3eb07baf806d80f6fcbbd5b082 (patch)
tree401bcb15745d2affe67695a08d02f7f0ad7428c8 /apps
parent1942abc126a2607d175e7aef5ae57c719f6d92be (diff)
All instances of ao2_iterators which were just named 'i' have been renamed
to 'mem_iter' so that when refcounted queues are merged into trunk, there will be little confusion regarding iterator names, especially when a queue and member iterator are used in the same function. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@82252 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c101
1 files changed, 51 insertions, 50 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index ac12f89e3..03f15e1ee 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -486,12 +486,12 @@ enum queue_member_status {
static enum queue_member_status get_member_status(struct call_queue *q, int max_penalty)
{
struct member *member;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
enum queue_member_status result = QUEUE_NO_MEMBERS;
ast_mutex_lock(&q->lock);
- i = ao2_iterator_init(q->members, 0);
- while ((member = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((member = ao2_iterator_next(&mem_iter))) {
if (max_penalty && (member->penalty > max_penalty)) {
ao2_ref(member, -1);
continue;
@@ -532,7 +532,7 @@ static void *changethread(void *data)
struct call_queue *q;
struct statechange *sc = data;
struct member *cur;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
struct member_interface *curint;
char *loc;
char *technology;
@@ -572,8 +572,8 @@ static void *changethread(void *data)
AST_LIST_LOCK(&queues);
AST_LIST_TRAVERSE(&queues, q, list) {
ast_mutex_lock(&q->lock);
- i = ao2_iterator_init(q->members, 0);
- while ((cur = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((cur = ao2_iterator_next(&mem_iter))) {
char *interface;
char *slash_pos;
interface = ast_strdupa(cur->interface);
@@ -1022,9 +1022,9 @@ static void free_members(struct call_queue *q, int all)
{
/* Free non-dynamic members */
struct member *cur;
- struct ao2_iterator i = ao2_iterator_init(q->members, 0);
+ struct ao2_iterator mem_iter = ao2_iterator_init(q->members, 0);
- while ((cur = ao2_iterator_next(&i))) {
+ while ((cur = ao2_iterator_next(&mem_iter))) {
if (all || !cur->dynamic) {
ao2_unlink(q->members, cur);
remove_from_interfaces(cur->interface);
@@ -1050,7 +1050,7 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
struct ast_variable *v;
struct call_queue *q;
struct member *m;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
char *interface = NULL;
char *tmp, *tmp_name;
char tmpbuf[64]; /* Must be longer than the longest queue param name. */
@@ -1129,8 +1129,8 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
/* Temporarily set realtime members dead so we can detect deleted ones.
* Also set the membercount correctly for realtime*/
- i = ao2_iterator_init(q->members, 0);
- while ((m = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((m = ao2_iterator_next(&mem_iter))) {
q->membercount++;
if (m->realtime)
m->dead = 1;
@@ -1145,8 +1145,8 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
}
/* Delete all realtime members that have been deleted in DB. */
- i = ao2_iterator_init(q->members, 0);
- while ((m = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((m = ao2_iterator_next(&mem_iter))) {
if (m->dead) {
ao2_unlink(q->members, m);
ast_mutex_unlock(&q->lock);
@@ -1186,7 +1186,7 @@ static void update_realtime_members(struct call_queue *q)
struct ast_config *member_config = NULL;
struct member *m;
char *interface = NULL;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL);
if (!member_config) {
@@ -1199,8 +1199,8 @@ static void update_realtime_members(struct call_queue *q)
ast_mutex_lock(&q->lock);
/* Temporarily set realtime members dead so we can detect deleted ones.*/
- i = ao2_iterator_init(q->members, 0);
- while ((m = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((m = ao2_iterator_next(&mem_iter))) {
if (m->realtime)
m->dead = 1;
ao2_ref(m, -1);
@@ -1214,8 +1214,8 @@ static void update_realtime_members(struct call_queue *q)
}
/* Delete all realtime members that have been deleted in DB. */
- i = ao2_iterator_init(q->members, 0);
- while ((m = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((m = ao2_iterator_next(&mem_iter))) {
if (m->dead) {
ao2_unlink(q->members, m);
ast_mutex_unlock(&q->lock);
@@ -1573,13 +1573,13 @@ static void hangupcalls(struct callattempt *outgoing, struct ast_channel *except
static int update_status(struct call_queue *q, struct member *member, int status)
{
struct member *cur;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
/* Since a reload could have taken place, we have to traverse the list to
be sure it's still valid */
ast_mutex_lock(&q->lock);
- i = ao2_iterator_init(q->members, 0);
- while ((cur = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((cur = ao2_iterator_next(&mem_iter))) {
if (member != cur) {
ao2_ref(cur, -1);
continue;
@@ -2233,8 +2233,8 @@ static int is_our_turn(struct queue_ent *qe)
ast_log(LOG_DEBUG, "Even though there are %d available members, the strategy is ringall so only the head call is allowed in\n", avl);
avl = 1;
} else {
- struct ao2_iterator i = ao2_iterator_init(qe->parent->members, 0);
- while ((cur = ao2_iterator_next(&i))) {
+ struct ao2_iterator mem_iter = ao2_iterator_init(qe->parent->members, 0);
+ while ((cur = ao2_iterator_next(&mem_iter))) {
switch (cur->status) {
case AST_DEVICE_NOT_INUSE:
case AST_DEVICE_UNKNOWN:
@@ -2826,13 +2826,13 @@ static int wait_a_bit(struct queue_ent *qe)
static struct member *interface_exists(struct call_queue *q, const char *interface)
{
struct member *mem;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
if (!q)
return NULL;
- i = ao2_iterator_init(q->members, 0);
- while ((mem = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((mem = ao2_iterator_next(&mem_iter))) {
if (!strcasecmp(interface, mem->interface))
return mem;
ao2_ref(mem, -1);
@@ -2853,15 +2853,15 @@ static void dump_queue_members(struct call_queue *pm_queue)
char value[PM_MAX_LEN];
int value_len = 0;
int res;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
memset(value, 0, sizeof(value));
if (!pm_queue)
return;
- i = ao2_iterator_init(pm_queue->members, 0);
- while ((cur_member = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(pm_queue->members, 0);
+ while ((cur_member = ao2_iterator_next(&mem_iter))) {
if (!cur_member->dynamic) {
ao2_ref(cur_member, -1);
continue;
@@ -3660,7 +3660,7 @@ static int queue_function_qac(struct ast_channel *chan, char *cmd, char *data, c
struct call_queue *q;
struct ast_module_user *lu;
struct member *m;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
buf[0] = '\0';
@@ -3681,8 +3681,8 @@ static int queue_function_qac(struct ast_channel *chan, char *cmd, char *data, c
AST_LIST_UNLOCK(&queues);
if (q) {
- i = ao2_iterator_init(q->members, 0);
- while ((m = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((m = ao2_iterator_next(&mem_iter))) {
/* Count the agents who are logged in and presently answering calls */
if ((m->status != AST_DEVICE_UNAVAILABLE) && (m->status != AST_DEVICE_INVALID)) {
count++;
@@ -3761,9 +3761,9 @@ static int queue_function_queuememberlist(struct ast_channel *chan, char *cmd, c
if (q) {
int buflen = 0, count = 0;
- struct ao2_iterator i = ao2_iterator_init(q->members, 0);
+ struct ao2_iterator mem_iter = ao2_iterator_init(q->members, 0);
- while ((m = ao2_iterator_next(&i))) {
+ while ((m = ao2_iterator_next(&mem_iter))) {
/* strcat() is always faster than printf() */
if (count++) {
strncat(buf + buflen, ",", len - buflen - 1);
@@ -3834,7 +3834,7 @@ static int reload_queues(void)
char *cat, *tmp;
struct ast_variable *var;
struct member *cur, *newm;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
int new;
const char *general_val = NULL;
char parse[80];
@@ -3894,8 +3894,8 @@ static int reload_queues(void)
/* Re-initialize the queue, and clear statistics */
init_queue(q);
clear_queue(q);
- i = ao2_iterator_init(q->members, 0);
- while ((cur = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((cur = ao2_iterator_next(&mem_iter))) {
if (!cur->dynamic) {
cur->delme = 1;
}
@@ -3944,8 +3944,8 @@ static int reload_queues(void)
}
/* Free remaining members marked as delme */
- i = ao2_iterator_init(q->members, 0);
- while ((cur = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((cur = ao2_iterator_next(&mem_iter))) {
if (! cur->delme) {
ao2_ref(cur, -1);
continue;
@@ -3977,8 +3977,8 @@ static int reload_queues(void)
ast_log(LOG_DEBUG, "XXX Leaking a little memory :( XXX\n");
} else {
ast_mutex_lock(&q->lock);
- i = ao2_iterator_init(q->members, 0);
- while ((cur = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((cur = ao2_iterator_next(&mem_iter))) {
if (cur->dynamic)
q->membercount++;
cur->status = ast_device_state(cur->interface);
@@ -4004,7 +4004,7 @@ static int __queues_show(struct mansession *s, int manager, int fd, int argc, ch
size_t max_left;
float sl = 0;
char *term = manager ? "\r\n" : "\n";
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
time(&now);
if (argc == 2)
@@ -4046,6 +4046,7 @@ static int __queues_show(struct mansession *s, int manager, int fd, int argc, ch
continue;
}
}
+ ast_log(LOG_DEBUG, "MEMBERCOUNT is %d\n", q->membercount);
max_buf[0] = '\0';
max = max_buf;
max_left = sizeof(max_buf);
@@ -4068,8 +4069,8 @@ static int __queues_show(struct mansession *s, int manager, int fd, int argc, ch
astman_append(s, " Members: %s", term);
else
ast_cli(fd, " Members: %s", term);
- i = ao2_iterator_init(q->members, 0);
- while ((mem = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((mem = ao2_iterator_next(&mem_iter))) {
max_buf[0] = '\0';
max = max_buf;
max_left = sizeof(max_buf);
@@ -4186,7 +4187,7 @@ static int manager_queues_status(struct mansession *s, const struct message *m)
struct queue_ent *qe;
float sl = 0;
struct member *mem;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
astman_send_ack(s, m, "Queue status will follow");
time(&now);
@@ -4215,8 +4216,8 @@ static int manager_queues_status(struct mansession *s, const struct message *m)
q->name, q->maxlen, q->count, q->holdtime, q->callscompleted,
q->callsabandoned, q->servicelevel, sl, q->weight, idText);
/* List Queue Members */
- i = ao2_iterator_init(q->members, 0);
- while ((mem = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((mem = ao2_iterator_next(&mem_iter))) {
if (ast_strlen_zero(memberfilter) || !strcmp(mem->interface, memberfilter)) {
astman_append(s, "Event: QueueMember\r\n"
"Queue: %s\r\n"
@@ -4497,7 +4498,7 @@ static char *complete_queue_remove_member(const char *line, const char *word, in
int which = 0;
struct call_queue *q;
struct member *m;
- struct ao2_iterator i;
+ struct ao2_iterator mem_iter;
/* 0 - queue; 1 - remove; 2 - member; 3 - <member>; 4 - from; 5 - <queue> */
if (pos > 5 || pos < 3)
@@ -4512,8 +4513,8 @@ static char *complete_queue_remove_member(const char *line, const char *word, in
if (!AST_LIST_EMPTY(&queues)) { /* XXX unnecessary ? the traverse does that for us */
AST_LIST_TRAVERSE(&queues, q, list) {
ast_mutex_lock(&q->lock);
- i = ao2_iterator_init(q->members, 0);
- while ((m = ao2_iterator_next(&i))) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((m = ao2_iterator_next(&mem_iter))) {
if (++which > state) {
char *tmp;
ast_mutex_unlock(&q->lock);