mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-24 04:04:16 +00:00
FSCORE-297 FSCORE-305 FSCORE-315
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12392 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
790f2c9b64
commit
8d965c32b2
8 files changed
+171
-228
No files matched your search
@@ -93,9 +93,9 @@ static void add_route(char *service, char *regex, char *replace)
|
||||
route = switch_core_alloc(globals.pool, sizeof(*route));
|
||||
|
||||
|
||||
route->service = strdup(service);
|
||||
route->regex = strdup(regex);
|
||||
route->replace = strdup(replace);
|
||||
route->service = switch_core_strdup(globals.pool, service);
|
||||
route->regex = switch_core_strdup(globals.pool, regex);
|
||||
route->replace = switch_core_strdup(globals.pool, replace);
|
||||
|
||||
switch_mutex_lock(MUTEX);
|
||||
if (!globals.route_order) {
|
||||
|
||||
@@ -2964,12 +2964,12 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
|
||||
|
||||
while (mod_sofia_globals.threads) {
|
||||
switch_cond_next();
|
||||
if (++sanity >= 10000) {
|
||||
if (++sanity >= 60000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch_yield(1000000);
|
||||
//switch_yield(1000000);
|
||||
su_deinit();
|
||||
|
||||
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
||||
|
||||
@@ -662,7 +662,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void launch_sofia_worker_thread(sofia_profile_t *profile)
|
||||
switch_thread_t *launch_sofia_worker_thread(sofia_profile_t *profile)
|
||||
{
|
||||
switch_thread_t *thread;
|
||||
switch_threadattr_t *thd_attr = NULL;
|
||||
@@ -680,6 +680,8 @@ void launch_sofia_worker_thread(sofia_profile_t *profile)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj)
|
||||
@@ -693,6 +695,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
||||
int use_timer = !sofia_test_pflag(profile, PFLAG_DISABLE_TIMER);
|
||||
const char *supported = NULL;
|
||||
int sanity;
|
||||
switch_thread_t *worker_thread;
|
||||
switch_status_t st;
|
||||
|
||||
switch_mutex_lock(mod_sofia_globals.mutex);
|
||||
mod_sofia_globals.threads++;
|
||||
@@ -823,7 +827,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
||||
profile->started = switch_epoch_time_now(NULL);
|
||||
|
||||
sofia_set_pflag_locked(profile, PFLAG_RUNNING);
|
||||
launch_sofia_worker_thread(profile);
|
||||
worker_thread = launch_sofia_worker_thread(profile);
|
||||
|
||||
switch_yield(1000000);
|
||||
|
||||
@@ -850,15 +854,11 @@ 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");
|
||||
|
||||
while (sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
|
||||
switch_yield(100000);
|
||||
}
|
||||
switch_thread_join(&st, worker_thread);
|
||||
|
||||
sanity = 4;
|
||||
while (profile->inuse) {
|
||||
@@ -3243,10 +3243,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
case nua_callstate_terminating:
|
||||
if (status == 488 || switch_channel_get_state(channel) == CS_HIBERNATE) {
|
||||
tech_pvt->q850_cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
|
||||
} else if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
|
||||
sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
|
||||
}
|
||||
break;
|
||||
case nua_callstate_terminated:
|
||||
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
|
||||
sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
|
||||
@@ -3274,17 +3271,17 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
switch_channel_hangup(channel, cause);
|
||||
}
|
||||
}
|
||||
|
||||
if (tech_pvt->sofia_private) {
|
||||
tech_pvt->sofia_private = NULL;
|
||||
}
|
||||
|
||||
tech_pvt->nh = NULL;
|
||||
|
||||
|
||||
if (nh) {
|
||||
nua_handle_bind(nh, NULL);
|
||||
nua_handle_destroy(nh);
|
||||
if (ss_state == nua_callstate_terminated) {
|
||||
if (tech_pvt->sofia_private) {
|
||||
tech_pvt->sofia_private = NULL;
|
||||
}
|
||||
|
||||
tech_pvt->nh = NULL;
|
||||
|
||||
if (nh) {
|
||||
nua_handle_bind(nh, NULL);
|
||||
nua_handle_destroy(nh);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -249,6 +249,20 @@ SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname)
|
||||
return val;
|
||||
}
|
||||
|
||||
static void switch_core_unset_variables(void)
|
||||
{
|
||||
switch_hash_index_t *hi;
|
||||
const void *var;
|
||||
void *val;
|
||||
|
||||
switch_mutex_lock(runtime.global_var_mutex);
|
||||
for (hi = switch_hash_first(NULL, runtime.global_vars); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &var, NULL, &val);
|
||||
free(val);
|
||||
}
|
||||
switch_mutex_unlock(runtime.global_var_mutex);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *value)
|
||||
{
|
||||
char *val;
|
||||
@@ -1488,6 +1502,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n");
|
||||
switch_log_shutdown();
|
||||
|
||||
switch_core_unset_variables();
|
||||
switch_core_memory_stop();
|
||||
|
||||
if (runtime.console && runtime.console != stdout && runtime.console != stderr) {
|
||||
|
||||
@@ -409,7 +409,26 @@ SWITCH_DECLARE(void) switch_rtp_get_random(void *buf, uint32_t len)
|
||||
|
||||
SWITCH_DECLARE(void) switch_rtp_shutdown(void)
|
||||
{
|
||||
switch_core_port_allocator_t *alloc = NULL;
|
||||
switch_hash_index_t *hi;
|
||||
const void *var;
|
||||
void *val;
|
||||
|
||||
switch_mutex_lock(port_lock);
|
||||
|
||||
for (hi = switch_hash_first(NULL, alloc_hash); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &var, NULL, &val);
|
||||
if ((alloc = (switch_core_port_allocator_t *) val)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy port allocator for %s\n", (char *)var);
|
||||
switch_core_port_allocator_destroy(&alloc);
|
||||
}
|
||||
}
|
||||
|
||||
switch_core_hash_destroy(&alloc_hash);
|
||||
switch_mutex_unlock(port_lock);
|
||||
|
||||
crypto_kernel_shutdown();
|
||||
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_port_t) switch_rtp_set_start_port(switch_port_t port)
|
||||
|
||||
Reference in new issue
Block a user