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_timer = !sofia_test_pflag(profile, PFLAG_DISABLE_TIMER);
|
||||
const char *supported = NULL;
|
||||
int sanity = 4;
|
||||
int sanity;
|
||||
|
||||
switch_mutex_lock(mod_sofia_globals.mutex);
|
||||
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);
|
||||
|
||||
switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
|
||||
sanity = 10;
|
||||
while (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);
|
||||
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);
|
||||
|
@ -841,6 +847,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||
sofia_reg_unregister(profile);
|
||||
nua_shutdown(profile->nua);
|
||||
su_root_run(profile->s_root);
|
||||
nua_shutdown(profile->nua);
|
||||
su_root_run(profile->s_root);
|
||||
|
||||
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n");
|
||||
|
@ -849,10 +857,12 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||
switch_yield(100000);
|
||||
}
|
||||
|
||||
sanity = 4;
|
||||
while (profile->inuse) {
|
||||
switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
|
||||
switch_yield(5000000);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Waiting for %d session(s)\n", profile->inuse);
|
||||
if (!sanity--) {
|
||||
if (!--sanity) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,8 +142,8 @@ SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause)
|
|||
switch_mutex_unlock(runtime.throttle_mutex);
|
||||
|
||||
while (session_manager.session_count > 0) {
|
||||
switch_yield(100000);
|
||||
if (++loops == 100) {
|
||||
switch_yield(1000000);
|
||||
if (++loops == 30) {
|
||||
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");
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue