mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 20:50:41 +00:00
tweak sofia profile shutdown
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11656 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b761924f34
commit
686c1c6c1f
@ -692,7 +692,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||||||
int use_100rel = !sofia_test_pflag(profile, PFLAG_DISABLE_100REL);
|
int use_100rel = !sofia_test_pflag(profile, PFLAG_DISABLE_100REL);
|
||||||
int use_timer = !sofia_test_pflag(profile, PFLAG_DISABLE_TIMER);
|
int use_timer = !sofia_test_pflag(profile, PFLAG_DISABLE_TIMER);
|
||||||
const char *supported = NULL;
|
const char *supported = NULL;
|
||||||
int sanity = 4;
|
int sanity;
|
||||||
|
|
||||||
switch_mutex_lock(mod_sofia_globals.mutex);
|
switch_mutex_lock(mod_sofia_globals.mutex);
|
||||||
mod_sofia_globals.threads++;
|
mod_sofia_globals.threads++;
|
||||||
@ -831,9 +831,15 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||||||
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
|
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
|
||||||
|
|
||||||
switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
|
switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
|
||||||
|
sanity = 10;
|
||||||
while (profile->inuse) {
|
while (profile->inuse) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Waiting for %d session(s)\n", profile->inuse);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Waiting for %d session(s)\n", profile->inuse);
|
||||||
su_root_step(profile->s_root, 1000);
|
su_root_step(profile->s_root, 1000);
|
||||||
|
if (!--sanity) {
|
||||||
|
break;
|
||||||
|
} else if (sanity == 5) {
|
||||||
|
switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock %s\n", profile->name);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock %s\n", profile->name);
|
||||||
@ -841,6 +847,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||||||
sofia_reg_unregister(profile);
|
sofia_reg_unregister(profile);
|
||||||
nua_shutdown(profile->nua);
|
nua_shutdown(profile->nua);
|
||||||
su_root_run(profile->s_root);
|
su_root_run(profile->s_root);
|
||||||
|
nua_shutdown(profile->nua);
|
||||||
|
su_root_run(profile->s_root);
|
||||||
|
|
||||||
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
|
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n");
|
||||||
@ -848,16 +856,18 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||||||
while (sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
|
while (sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
|
||||||
switch_yield(100000);
|
switch_yield(100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sanity = 4;
|
||||||
while (profile->inuse) {
|
while (profile->inuse) {
|
||||||
|
switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
|
||||||
switch_yield(5000000);
|
switch_yield(5000000);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Waiting for %d session(s)\n", profile->inuse);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Waiting for %d session(s)\n", profile->inuse);
|
||||||
if (!sanity--) {
|
if (!--sanity) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nua_destroy(profile->nua);
|
nua_destroy(profile->nua);
|
||||||
|
|
||||||
switch_mutex_lock(profile->ireg_mutex);
|
switch_mutex_lock(profile->ireg_mutex);
|
||||||
switch_mutex_unlock(profile->ireg_mutex);
|
switch_mutex_unlock(profile->ireg_mutex);
|
||||||
|
|
||||||
|
@ -142,8 +142,8 @@ SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause)
|
|||||||
switch_mutex_unlock(runtime.throttle_mutex);
|
switch_mutex_unlock(runtime.throttle_mutex);
|
||||||
|
|
||||||
while (session_manager.session_count > 0) {
|
while (session_manager.session_count > 0) {
|
||||||
switch_yield(100000);
|
switch_yield(1000000);
|
||||||
if (++loops == 100) {
|
if (++loops == 30) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Giving up with %d session%s remaining\n",
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Giving up with %d session%s remaining\n",
|
||||||
session_manager.session_count, session_manager.session_count == 1 ? "" : "s");
|
session_manager.session_count, session_manager.session_count == 1 ? "" : "s");
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user