From eb9e2f2c4e2b2ab5687e9c78af1fd5c3c6641f4e Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Sun, 1 Mar 2009 22:07:09 +0000 Subject: [PATCH] Add error checking when updating the "paused" field of a realtime queue member. This code already existed in trunk and 1.6.1, but was not in 1.6.0 prior to this commit. (closes issue #14338) Reported by: fiddur Patches: 14338.patch uploaded by mmichelson (license 60) Tested by: fiddur git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@179222 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_queue.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/app_queue.c b/apps/app_queue.c index ac1d0a3173..70704f02be 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -4131,6 +4131,7 @@ static int set_member_paused(const char *queuename, const char *interface, const struct call_queue *q; struct member *mem; struct ao2_iterator queue_iter; + int failed; /* Special event for when all queues are paused - individual events still generated */ /* XXX In all other cases, we use the membername, but since this affects all queues, we cannot */ @@ -4146,14 +4147,24 @@ static int set_member_paused(const char *queuename, const char *interface, const if (mem->paused == paused) { ast_debug(1, "%spausing already-%spaused queue member %s:%s\n", (paused ? "" : "un"), (paused ? "" : "un"), q->name, interface); } + + failed = 0; + if (mem->realtime) { + failed = update_realtime_member_field(mem, q->name, "paused", paused ? "1" : "0"); + } + + if (failed) { + ast_log(LOG_WARNING, "Failed %spausing realtime queue member %s:%s\n", (paused ? "" : "un"), q->name, interface); + ao2_ref(mem, -1); + ao2_unlock(q); + continue; + } + mem->paused = paused; if (queue_persistent_members) dump_queue_members(q); - if (mem->realtime) - update_realtime_member_field(mem, q->name, "paused", paused ? "1" : "0"); - ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", S_OR(reason, "")); if (!ast_strlen_zero(reason)) {