[asterisk-commits] mmichelson: branch mmichelson/queue-reset r102565 - /team/mmichelson/queue-re...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Feb 5 18:16:53 CST 2008
Author: mmichelson
Date: Tue Feb 5 18:16:53 2008
New Revision: 102565
URL: http://svn.digium.com/view/asterisk?view=rev&rev=102565
Log:
Make code more readable in places
Modified:
team/mmichelson/queue-reset/apps/app_queue.c
Modified: team/mmichelson/queue-reset/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-reset/apps/app_queue.c?view=diff&rev=102565&r1=102564&r2=102565
==============================================================================
--- team/mmichelson/queue-reset/apps/app_queue.c (original)
+++ team/mmichelson/queue-reset/apps/app_queue.c Tue Feb 5 18:16:53 2008
@@ -5025,8 +5025,8 @@
};
const char *tmpvar;
struct ao2_iterator mem_iter;
- int queue_reload = mask & QUEUE_RELOAD;
- int member_reload = mask & QUEUE_RELOAD_MEMBER;
+ const int queue_reload = mask & QUEUE_RELOAD;
+ const int member_reload = mask & QUEUE_RELOAD_MEMBER;
int prev_weight = 0;
struct member *cur;
struct ast_variable *var;
@@ -5091,9 +5091,7 @@
if (!strcasecmp(var->name, "member")) {
if (member_reload)
reload_single_member(var->value, q);
- continue;
- }
- if (queue_reload)
+ } else if (queue_reload)
queue_set_param(q, var->name, var->value, var->lineno, 1);
}
/* At this point, we've determined if the queue has a weight, so update use_weight
@@ -5137,6 +5135,8 @@
char *cat;
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
struct ao2_iterator queue_iter;
+ const int queue_reload = mask & QUEUE_RELOAD;
+ const int member_reload = mask & QUEUE_MEMBER_RELOAD;
if (!(cfg = ast_config_load("queues.conf", config_flags))) {
ast_log(LOG_NOTICE, "No call queueing config file (queues.conf), so no call queues\n");
@@ -5150,7 +5150,7 @@
/* Mark all queues as dead for the moment if we're reloading queues.
* For clarity, we could just be reloading members, in which case we don't want to mess
* with the actual queues at all*/
- if (mask & QUEUE_RELOAD) {
+ if (queue_reload) {
queue_iter = ao2_iterator_init(queues, F_AO2I_DONTLOCK);
while ((q = ao2_iterator_next(&queue_iter))) {
/* We don't want to affect realtime queues at all during a reload */
@@ -5165,7 +5165,7 @@
/* Chug through config file */
cat = NULL;
while ((cat = ast_category_browse(cfg, cat)) ) {
- if (!strcasecmp(cat, "general")) {
+ if (!strcasecmp(cat, "general") && queue_reload) {
queue_set_global_params(cfg);
continue;
}
@@ -5175,12 +5175,11 @@
ast_config_destroy(cfg);
/* Deref all the dead queues if we were reloading queues */
- if (mask & QUEUE_RELOAD) {
+ if (queue_reload) {
queue_iter = ao2_iterator_init(queues, 0);
while ((q = ao2_iterator_next(&queue_iter))) {
- if ((ast_strlen_zero(queuename) || !strcasecmp(queuename, q->name)) && q->dead) {
- ao2_unlink(queues, q);
- }
+ if ((ast_strlen_zero(queuename) || !strcasecmp(queuename, q->name)) && q->dead)
+ ao2_unlink(queues, q);
queue_unref(q);
}
}
More information about the asterisk-commits
mailing list