[asterisk-commits] mmichelson: trunk r85959 - in /trunk: ./ apps/app_queue.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 16 16:16:01 CDT 2007
Author: mmichelson
Date: Tue Oct 16 16:16:00 2007
New Revision: 85959
URL: http://svn.digium.com/view/asterisk?view=rev&rev=85959
Log:
Merged revisions 85958 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r85958 | mmichelson | 2007-10-16 16:14:34 -0500 (Tue, 16 Oct 2007) | 5 lines
Trying to remove a non-dynamic queue member via dynamic means can lead to some
interesting (read nasty) situations. This patch clears up the issue by making
only dynamic queue members removable via dynamic methods.
........
Modified:
trunk/ (props changed)
trunk/apps/app_queue.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=85959&r1=85958&r2=85959
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Tue Oct 16 16:16:00 2007
@@ -126,6 +126,7 @@
#define RES_EXISTS (-1) /* Entry already exists */
#define RES_OUTOFMEMORY (-2) /* Out of memory */
#define RES_NOSUCHQUEUE (-3) /* No such queue */
+#define RES_NOT_DYNAMIC (-4) /* Member is not dynamic */
static char *app = "Queue";
@@ -3210,13 +3211,21 @@
ast_copy_string(tmpq.name, queuename, sizeof(tmpq.name));
if((q = ao2_find(queues, &tmpq, OBJ_POINTER))) {
ao2_lock(q);
- if ((mem = ao2_find(q->members, &tmpmem, OBJ_POINTER | OBJ_UNLINK))) {
+ if ((mem = ao2_find(q->members, &tmpmem, OBJ_POINTER))) {
+ /* XXX future changes should beware of this assumption!! */
+ if(!mem->dynamic) {
+ res = RES_NOT_DYNAMIC;
+ ao2_ref(mem, -1);
+ ast_mutex_unlock(&q->lock);
+ break;
+ }
q->membercount--;
manager_event(EVENT_FLAG_AGENT, "QueueMemberRemoved",
"Queue: %s\r\n"
"Location: %s\r\n"
"MemberName: %s\r\n",
q->name, mem->interface, mem->membername);
+ ao2_unlink(q->members, mem);
ao2_ref(mem, -1);
if (queue_persistent_members)
@@ -3551,6 +3560,11 @@
case RES_NOSUCHQUEUE:
ast_log(LOG_WARNING, "Unable to remove interface from queue '%s': No such queue\n", args.queuename);
pbx_builtin_setvar_helper(chan, "RQMSTATUS", "NOSUCHQUEUE");
+ res = 0;
+ break;
+ case RES_NOT_DYNAMIC:
+ ast_log(LOG_WARNING, "Unable to remove interface from queue '%s': '%s' is not a dynamic member\n", args.queuename, args.interface);
+ pbx_builtin_setvar_helper(chan, "RQMSTATUS", "NOTDYNAMIC");
res = 0;
break;
}
@@ -4686,6 +4700,9 @@
case RES_OUTOFMEMORY:
astman_send_error(s, m, "Out of memory");
break;
+ case RES_NOT_DYNAMIC:
+ astman_send_error(s, m, "Member not dynamic");
+ break;
}
return 0;
@@ -4826,6 +4843,9 @@
case RES_OUTOFMEMORY:
ast_cli(a->fd, "Out of memory\n");
return CLI_FAILURE;
+ case RES_NOT_DYNAMIC:
+ ast_cli(fd, "Member not dynamic\n");
+ return RESULT_FAILURE;
default:
return CLI_FAILURE;
}
More information about the asterisk-commits
mailing list