FS-3594 --resolve
This commit is contained in:
parent
d39b7c6b1a
commit
efeaf2069e
|
@ -625,6 +625,7 @@ struct sofia_profile {
|
|||
uint32_t event_timeout;
|
||||
int watchdog_enabled;
|
||||
switch_mutex_t *gw_mutex;
|
||||
uint32_t queued_events;
|
||||
};
|
||||
|
||||
struct private_object {
|
||||
|
|
|
@ -1137,7 +1137,8 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep)
|
|||
sofia_dispatch_event_t *de = *dep;
|
||||
nua_handle_t *nh = de->nh;
|
||||
nua_t *nua = de->nua;
|
||||
|
||||
sofia_profile_t *profile = de->profile;
|
||||
|
||||
*dep = NULL;
|
||||
|
||||
our_sofia_event_callback(de->data->e_event, de->data->e_status, de->data->e_phrase, de->nua, de->profile,
|
||||
|
@ -1145,6 +1146,10 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep)
|
|||
|
||||
nua_destroy_event(de->event);
|
||||
su_free(nh->nh_home, de);
|
||||
|
||||
switch_mutex_lock(profile->flag_mutex);
|
||||
profile->queued_events--;
|
||||
switch_mutex_unlock(profile->flag_mutex);
|
||||
|
||||
nua_handle_unref(nh);
|
||||
nua_stack_unref(nua);
|
||||
|
@ -1245,6 +1250,10 @@ void sofia_event_callback(nua_event_t event,
|
|||
{
|
||||
sofia_dispatch_event_t *de;
|
||||
|
||||
switch_mutex_lock(profile->flag_mutex);
|
||||
profile->queued_events++;
|
||||
switch_mutex_unlock(profile->flag_mutex);
|
||||
|
||||
de = su_alloc(nh->nh_home, sizeof(*de));
|
||||
memset(de, 0, sizeof(*de));
|
||||
nua_save_event(nua, de->event);
|
||||
|
@ -1972,7 +1981,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||
nua_shutdown(profile->nua);
|
||||
|
||||
sanity = 10;
|
||||
while (!sofia_test_pflag(profile, PFLAG_SHUTDOWN)) {
|
||||
while (!sofia_test_pflag(profile, PFLAG_SHUTDOWN) || profile->queued_events > 0) {
|
||||
su_root_step(profile->s_root, 1000);
|
||||
if (!--sanity) {
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue