mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-03 11:58:36 +00:00
speed up restart speed of profiles
This commit is contained in:
parent
c6c247d35c
commit
fb5f29c2fb
@ -251,6 +251,7 @@ typedef enum {
|
|||||||
PFLAG_LIBERAL_DTMF,
|
PFLAG_LIBERAL_DTMF,
|
||||||
PFLAG_AUTO_ASSIGN_PORT,
|
PFLAG_AUTO_ASSIGN_PORT,
|
||||||
PFLAG_AUTO_ASSIGN_TLS_PORT,
|
PFLAG_AUTO_ASSIGN_TLS_PORT,
|
||||||
|
PFLAG_SHUTDOWN,
|
||||||
/* No new flags below this line */
|
/* No new flags below this line */
|
||||||
PFLAG_MAX
|
PFLAG_MAX
|
||||||
} PFLAGS;
|
} PFLAGS;
|
||||||
|
@ -959,6 +959,7 @@ static void our_sofia_event_callback(nua_event_t event,
|
|||||||
break;
|
break;
|
||||||
case nua_r_shutdown:
|
case nua_r_shutdown:
|
||||||
if (status >= 200) {
|
if (status >= 200) {
|
||||||
|
sofia_set_pflag(profile, PFLAG_SHUTDOWN);
|
||||||
su_root_break(profile->s_root);
|
su_root_break(profile->s_root);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1955,9 +1956,17 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||||||
switch_thread_rwlock_wrlock(profile->rwlock);
|
switch_thread_rwlock_wrlock(profile->rwlock);
|
||||||
sofia_reg_unregister(profile);
|
sofia_reg_unregister(profile);
|
||||||
nua_shutdown(profile->nua);
|
nua_shutdown(profile->nua);
|
||||||
su_root_run(profile->s_root);
|
|
||||||
|
|
||||||
|
sanity = 10;
|
||||||
|
while (!sofia_test_pflag(profile, PFLAG_SHUTDOWN)) {
|
||||||
|
su_root_step(profile->s_root, 1000);
|
||||||
|
if (!--sanity) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
|
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
|
||||||
|
sofia_clear_pflag_locked(profile, PFLAG_SHUTDOWN);
|
||||||
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");
|
||||||
|
|
||||||
switch_thread_join(&st, worker_thread);
|
switch_thread_join(&st, worker_thread);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user