fix answer contention issue

This commit is contained in:
Anthony Minessale 2012-12-06 11:11:02 -06:00
parent ad57781be4
commit 7e8e99e52c
3 changed files with 12 additions and 12 deletions

View 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);
}
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;

View 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;

View 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);