]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fixes random deadlock in app_queue with use_weight during reload
authorDavid Vossel <dvossel@digium.com>
Wed, 10 Feb 2010 17:44:20 +0000 (17:44 +0000)
committerDavid Vossel <dvossel@digium.com>
Wed, 10 Feb 2010 17:44:20 +0000 (17:44 +0000)
(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/branches/1.4@246115 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c

index 763f88f3a5b8d30455af8b3c95ba6c8a15974aa1..46fddf615021544970f9c5b48e7ded3ae92d9835 100644 (file)
@@ -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