summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vossel <dvossel@digium.com>2010-02-10 17:49:34 +0000
committerDavid Vossel <dvossel@digium.com>2010-02-10 17:49:34 +0000
commitfa156c067d2f83a4bb7c3f6b2d0bae577aba944a (patch)
treee5f746ab714df55e7c93fe66af01fa0b54b97176
parent556260ad93d5bf8a247e4953ac348833278c003a (diff)
Merged revisions 246115 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r246115 | dvossel | 2010-02-10 11:44:20 -0600 (Wed, 10 Feb 2010) | 8 lines fixes random deadlock in app_queue with use_weight during reload (closes issue #16677) Reported by: tim_ringenbach Patches: app_queue_use_weight_deadlock.diff uploaded by tim ringenbach (license 540) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246116 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--apps/app_queue.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index de771da38..8bc150786 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4022,6 +4022,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
struct ao2_iterator memi;
struct ast_datastore *datastore, *transfer_ds;
struct queue_end_bridge *queue_end_bridge = NULL;
+ const int need_weight = use_weight;
ast_channel_lock(qe->chan);
datastore = ast_channel_datastore_find(qe->chan, &dialed_interface_info, NULL);
@@ -4105,7 +4106,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
}
/* Hold the lock while we setup the outgoing calls */
- if (use_weight)
+ if (need_weight)
ao2_lock(queues);
ao2_lock(qe->parent);
ast_debug(1, "%s is trying to call a queue member.\n",
@@ -4125,7 +4126,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
ao2_ref(cur, -1);
ao2_unlock(qe->parent);
ao2_iterator_destroy(&memi);
- if (use_weight)
+ if (need_weight)
ao2_unlock(queues);
goto out;
}
@@ -4134,7 +4135,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
ao2_ref(cur, -1);
ao2_unlock(qe->parent);
ao2_iterator_destroy(&memi);
- if (use_weight)
+ if (need_weight)
ao2_unlock(queues);
free(tmp);
goto out;
@@ -4144,7 +4145,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
ao2_ref(cur, -1);
ao2_unlock(&qe->parent);
ao2_iterator_destroy(&memi);
- if (use_weight)
+ if (need_weight)
ao2_unlock(queues);
free(tmp);
goto out;
@@ -4193,7 +4194,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
ao2_ref(cur, -1);
ao2_unlock(qe->parent);
ao2_iterator_destroy(&memi);
- if (use_weight)
+ if (need_weight)
ao2_unlock(queues);
free(tmp);
goto out;
@@ -4250,7 +4251,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
++qe->pending;
ao2_unlock(qe->parent);
ring_one(qe, outgoing, &numbusies);
- if (use_weight)
+ if (need_weight)
ao2_unlock(queues);
lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed, update_connectedline);
/* The ast_channel_datastore_remove() function could fail here if the