aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-02-10 17:44:20 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-02-10 17:44:20 +0000
commit3d6d58ccd39de3ede4f94fe1d803c92913205370 (patch)
tree546e21138caee8c29b9f1bb6cf33c84cdf71fd01 /apps
parent27725d3c896b8c9fa0b9c408e993b2f85abbed62 (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@246115 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 763f88f3a..46fddf615 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2822,6 +2822,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
int callcompletedinsl;
struct ao2_iterator memi;
struct ast_datastore *datastore, *transfer_ds;
+ const int need_weight = use_weight;
ast_channel_lock(qe->chan);
datastore = ast_channel_datastore_find(qe->chan, &dialed_interface_info, NULL);
@@ -2875,7 +2876,8 @@ 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)
AST_LIST_LOCK(&queues);
ao2_lock(qe->parent);
if (option_debug)
@@ -2896,7 +2898,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
ao2_iterator_destroy(&memi);
ao2_ref(cur, -1);
ao2_unlock(qe->parent);
- if (use_weight)
+ if (need_weight)
AST_LIST_UNLOCK(&queues);
goto out;
}
@@ -2905,7 +2907,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
ao2_iterator_destroy(&memi);
ao2_ref(cur, -1);
ao2_unlock(qe->parent);
- if (use_weight)
+ if (need_weight)
AST_LIST_UNLOCK(&queues);
free(tmp);
goto out;
@@ -2915,7 +2917,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
ao2_iterator_destroy(&memi);
ao2_ref(cur, -1);
ao2_unlock(qe->parent);
- if (use_weight)
+ if (need_weight)
AST_LIST_UNLOCK(&queues);
free(tmp);
goto out;
@@ -2953,7 +2955,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
ao2_iterator_destroy(&memi);
ao2_ref(cur, -1);
ao2_unlock(qe->parent);
- if (use_weight)
+ if (need_weight)
AST_LIST_UNLOCK(&queues);
free(tmp);
goto out;
@@ -2994,7 +2996,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)
AST_LIST_UNLOCK(&queues);
lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed);
/* The ast_channel_datastore_remove() function could fail here if the