mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-10 09:13:24 +00:00
cleanup
This commit is contained in:
parent
3d0c245f80
commit
18cd797065
@ -5886,7 +5886,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
|
|||||||
{
|
{
|
||||||
int sanity = 0;
|
int sanity = 0;
|
||||||
int i;
|
int i;
|
||||||
|
switch_status_t st;
|
||||||
|
|
||||||
switch_console_del_complete_func("::sofia::list_profiles");
|
switch_console_del_complete_func("::sofia::list_profiles");
|
||||||
switch_console_set_complete("del sofia");
|
switch_console_set_complete("del sofia");
|
||||||
@ -5903,6 +5903,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
|
|||||||
switch_event_unbind_callback(event_handler);
|
switch_event_unbind_callback(event_handler);
|
||||||
|
|
||||||
switch_queue_push(mod_sofia_globals.presence_queue, NULL);
|
switch_queue_push(mod_sofia_globals.presence_queue, NULL);
|
||||||
|
switch_queue_interrupt_all(mod_sofia_globals.presence_queue);
|
||||||
|
|
||||||
while (mod_sofia_globals.threads) {
|
while (mod_sofia_globals.threads) {
|
||||||
switch_cond_next();
|
switch_cond_next();
|
||||||
@ -5914,14 +5915,17 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
|
|||||||
|
|
||||||
for (i = 0; mod_sofia_globals.msg_queue_thread[i]; i++) {
|
for (i = 0; mod_sofia_globals.msg_queue_thread[i]; i++) {
|
||||||
switch_queue_push(mod_sofia_globals.msg_queue, NULL);
|
switch_queue_push(mod_sofia_globals.msg_queue, NULL);
|
||||||
|
switch_queue_interrupt_all(mod_sofia_globals.msg_queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; mod_sofia_globals.msg_queue_thread[i]; i++) {
|
for (i = 0; mod_sofia_globals.msg_queue_thread[i]; i++) {
|
||||||
switch_status_t st;
|
|
||||||
switch_thread_join(&st, mod_sofia_globals.msg_queue_thread[i]);
|
switch_thread_join(&st, mod_sofia_globals.msg_queue_thread[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mod_sofia_globals.presence_thread) {
|
||||||
|
switch_thread_join(&st, mod_sofia_globals.presence_thread);
|
||||||
|
}
|
||||||
|
|
||||||
//switch_yield(1000000);
|
//switch_yield(1000000);
|
||||||
su_deinit();
|
su_deinit();
|
||||||
|
@ -391,6 +391,7 @@ struct mod_sofia_globals {
|
|||||||
char *capture_server;
|
char *capture_server;
|
||||||
int rewrite_multicasted_fs_path;
|
int rewrite_multicasted_fs_path;
|
||||||
int presence_flush;
|
int presence_flush;
|
||||||
|
switch_thread_t *presence_thread;
|
||||||
};
|
};
|
||||||
extern struct mod_sofia_globals mod_sofia_globals;
|
extern struct mod_sofia_globals mod_sofia_globals;
|
||||||
|
|
||||||
@ -698,6 +699,7 @@ struct sofia_profile {
|
|||||||
sofia_paid_type_t paid_type;
|
sofia_paid_type_t paid_type;
|
||||||
uint32_t rtp_digit_delay;
|
uint32_t rtp_digit_delay;
|
||||||
switch_queue_t *event_queue;
|
switch_queue_t *event_queue;
|
||||||
|
switch_thread_t *thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct private_object {
|
struct private_object {
|
||||||
|
@ -2660,14 +2660,14 @@ void sofia_profile_destroy(sofia_profile_t *profile)
|
|||||||
|
|
||||||
void launch_sofia_profile_thread(sofia_profile_t *profile)
|
void launch_sofia_profile_thread(sofia_profile_t *profile)
|
||||||
{
|
{
|
||||||
switch_thread_t *thread;
|
//switch_thread_t *thread;
|
||||||
switch_threadattr_t *thd_attr = NULL;
|
switch_threadattr_t *thd_attr = NULL;
|
||||||
|
|
||||||
switch_threadattr_create(&thd_attr, profile->pool);
|
switch_threadattr_create(&thd_attr, profile->pool);
|
||||||
switch_threadattr_detach_set(thd_attr, 1);
|
switch_threadattr_detach_set(thd_attr, 1);
|
||||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||||
switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME);
|
switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME);
|
||||||
switch_thread_create(&thread, thd_attr, sofia_profile_thread_run, profile, profile->pool);
|
switch_thread_create(&profile->thread, thd_attr, sofia_profile_thread_run, profile, profile->pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void logger(void *logarg, char const *fmt, va_list ap)
|
static void logger(void *logarg, char const *fmt, va_list ap)
|
||||||
@ -3415,7 +3415,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod_sofia_globals.auto_restart = SWITCH_TRUE;
|
mod_sofia_globals.auto_restart = SWITCH_TRUE;
|
||||||
mod_sofia_globals.reg_deny_binding_fetch_and_no_lookup = SWITCH_FALSE; /* handle backwards compatilibity - by default use new behavior */
|
mod_sofia_globals.reg_deny_binding_fetch_and_no_lookup = SWITCH_TRUE; /* handle backwards compatilibity - by default use new behavior */
|
||||||
mod_sofia_globals.rewrite_multicasted_fs_path = SWITCH_FALSE;
|
mod_sofia_globals.rewrite_multicasted_fs_path = SWITCH_FALSE;
|
||||||
|
|
||||||
if ((settings = switch_xml_child(cfg, "global_settings"))) {
|
if ((settings = switch_xml_child(cfg, "global_settings"))) {
|
||||||
|
@ -377,10 +377,12 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
|
|||||||
switch_safe_free(remote_host);
|
switch_safe_free(remote_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_console_free_matches(&list);
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
|
if (list) {
|
||||||
|
switch_console_free_matches(&list);
|
||||||
|
}
|
||||||
|
|
||||||
switch_safe_free(contact);
|
switch_safe_free(contact);
|
||||||
switch_safe_free(route_uri);
|
switch_safe_free(route_uri);
|
||||||
switch_safe_free(ffrom);
|
switch_safe_free(ffrom);
|
||||||
@ -1625,7 +1627,7 @@ void *SWITCH_THREAD_FUNC sofia_presence_event_thread_run(switch_thread_t *thread
|
|||||||
|
|
||||||
void sofia_presence_event_thread_start(void)
|
void sofia_presence_event_thread_start(void)
|
||||||
{
|
{
|
||||||
switch_thread_t *thread;
|
//switch_thread_t *thread;
|
||||||
switch_threadattr_t *thd_attr = NULL;
|
switch_threadattr_t *thd_attr = NULL;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
@ -1642,10 +1644,10 @@ void sofia_presence_event_thread_start(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch_threadattr_create(&thd_attr, mod_sofia_globals.pool);
|
switch_threadattr_create(&thd_attr, mod_sofia_globals.pool);
|
||||||
switch_threadattr_detach_set(thd_attr, 1);
|
//switch_threadattr_detach_set(thd_attr, 1);
|
||||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||||
switch_threadattr_priority_set(thd_attr, SWITCH_PRI_IMPORTANT);
|
switch_threadattr_priority_set(thd_attr, SWITCH_PRI_IMPORTANT);
|
||||||
switch_thread_create(&thread, thd_attr, sofia_presence_event_thread_run, NULL, mod_sofia_globals.pool);
|
switch_thread_create(&mod_sofia_globals.presence_thread, thd_attr, sofia_presence_event_thread_run, NULL, mod_sofia_globals.pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -921,6 +921,10 @@ char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const c
|
|||||||
|
|
||||||
switch_safe_free(sql);
|
switch_safe_free(sql);
|
||||||
|
|
||||||
|
if (cbt.list) {
|
||||||
|
switch_console_free_matches(&cbt.list);
|
||||||
|
}
|
||||||
|
|
||||||
if (cbt.matches) {
|
if (cbt.matches) {
|
||||||
return val;
|
return val;
|
||||||
} else {
|
} else {
|
||||||
@ -1049,6 +1053,7 @@ static int debounce_check(sofia_profile_t *profile, const char *user, const char
|
|||||||
} else {
|
} else {
|
||||||
last = switch_core_alloc(profile->pool, sizeof(*last));
|
last = switch_core_alloc(profile->pool, sizeof(*last));
|
||||||
*last = now;
|
*last = now;
|
||||||
|
|
||||||
switch_core_hash_insert(profile->mwi_debounce_hash, key, last);
|
switch_core_hash_insert(profile->mwi_debounce_hash, key, last);
|
||||||
r = 1;
|
r = 1;
|
||||||
}
|
}
|
||||||
@ -1652,8 +1657,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
|||||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REGISTER) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REGISTER) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", profile->name);
|
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", profile->name);
|
||||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "from-user", to_user);
|
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "from-user", to_user);
|
||||||
|
@ -597,11 +597,17 @@ void switch_core_memory_stop(void)
|
|||||||
{
|
{
|
||||||
#ifndef INSTANTLY_DESTROY_POOLS
|
#ifndef INSTANTLY_DESTROY_POOLS
|
||||||
switch_status_t st;
|
switch_status_t st;
|
||||||
|
void *pop = NULL;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping memory pool queue.\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping memory pool queue.\n");
|
||||||
|
|
||||||
memory_manager.pool_thread_running = 0;
|
memory_manager.pool_thread_running = 0;
|
||||||
switch_thread_join(&st, pool_thread_p);
|
switch_thread_join(&st, pool_thread_p);
|
||||||
|
|
||||||
|
|
||||||
|
while (switch_queue_trypop(memory_manager.pool_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
|
||||||
|
apr_pool_destroy(pop);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1392,10 +1392,15 @@ SWITCH_DECLARE(int) switch_sql_queue_manager_size(switch_sql_queue_manager_t *qm
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_stop(switch_sql_queue_manager_t *qm)
|
SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_stop(switch_sql_queue_manager_t *qm)
|
||||||
{
|
{
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (qm->thread_running) {
|
if (qm->thread_running) {
|
||||||
qm->thread_running = 0;
|
qm->thread_running = 0;
|
||||||
switch_queue_push(qm->sql_queue[0], NULL);
|
|
||||||
|
for(i = 0; i < qm->numq; i++) {
|
||||||
|
switch_queue_push(qm->sql_queue[i], NULL);
|
||||||
|
switch_queue_interrupt_all(qm->sql_queue[i]);
|
||||||
|
}
|
||||||
qm_wake(qm);
|
qm_wake(qm);
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user