]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix answer contention issue
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 6 Dec 2012 17:11:02 +0000 (11:11 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 6 Dec 2012 17:11:07 +0000 (11:11 -0600)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/switch_core_sqldb.c

index 73c50565fee0b5894ad0c2c130d3bf2a3d1a9963..c75fdce179ee5315768ef99ebe043c02cb0cb6b9 100644 (file)
@@ -1567,15 +1567,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        de->session = session;
                }
 
-               if (de->data->e_event == nua_i_cancel || de->data->e_event == nua_i_bye) {
-                       sofia_set_flag(tech_pvt, TFLAG_SIGDEAD);
-               }
+               sofia_process_dispatch_event(&de);
 
-               if (!sofia_test_flag(tech_pvt, TFLAG_SIGDEAD) && (switch_channel_media_up(channel) || switch_channel_get_state(channel) > CS_ROUTING)) {
-                       sofia_queue_message(de);
-               } else {
-                       sofia_process_dispatch_event(&de);
-               }
 
                switch_mutex_unlock(tech_pvt->sofia_mutex);
                goto end;
index 146ef4fd44446e18998464663ce6c30cefa8c0ca..82c68516fbf96f374a7c9d54fb3a79167106d915 100644 (file)
@@ -353,7 +353,6 @@ typedef enum {
        TFLAG_PASS_ACK,
        TFLAG_CRYPTO_RECOVER,
        TFLAG_DROP_DTMF,
-       TFLAG_SIGDEAD,
        /* No new flags below this line */
        TFLAG_MAX
 } TFLAGS;
index 3860af15d4ebc61fe049ed49c5bf87cc21a2c7cb..802ce6b28ada39d13c7b8f9f9ee1df751ed17d09 100644 (file)
@@ -1261,6 +1261,7 @@ struct switch_sql_queue_manager {
        char *inner_post_trans_execute;
        switch_memory_pool_t *pool;
        uint32_t max_trans;
+       uint32_t confirm;
 };
 
 static int qm_wake(switch_sql_queue_manager_t *qm)
@@ -1431,6 +1432,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql
        }
 
        switch_mutex_lock(qm->mutex);
+       qm->confirm++;
        switch_queue_push(qm->sql_queue[pos], dup ? strdup(sql) : (char *)sql);
        written = qm->pre_written[pos];
        size = switch_sql_queue_manager_size(qm, pos);
@@ -1451,6 +1453,10 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql
                }
        }
 
+       switch_mutex_lock(qm->mutex);
+       qm->confirm--;
+       switch_mutex_unlock(qm->mutex);
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1733,11 +1739,13 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
                        switch_thread_cond_wait(qm->cond, qm->cond_mutex);
                }
 
-               i = 4;
+               i = 40;
 
-               while (--i > 0 && (lc = qm_ttl(qm)) < qm->max_trans / 4) {
-                       switch_yield(50000);
+               while (--i > 0 && (lc = qm_ttl(qm)) < qm->max_trans / 4 && !qm->confirm) {
+                       switch_yield(5000);
                }
+
+
        }
 
        switch_mutex_unlock(qm->cond_mutex);