mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merge "chan_sip: Reorder unload_module to deal with stuck TCP threads." into 13
This commit is contained in:
@@ -1774,7 +1774,7 @@ static void destroy_escs(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_LEN(event_state_compositors); i++) {
|
||||
ao2_cleanup(event_state_compositors[i].compositor);
|
||||
ao2_replace(event_state_compositors[i].compositor, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35273,6 +35273,8 @@ static int unload_module(void)
|
||||
struct ao2_iterator i;
|
||||
struct timeval start;
|
||||
|
||||
ast_sched_dump(sched);
|
||||
|
||||
ast_sip_api_provider_unregister();
|
||||
|
||||
if (sip_cfg.websocket_enabled) {
|
||||
@@ -35282,12 +35284,11 @@ static int unload_module(void)
|
||||
network_change_stasis_unsubscribe();
|
||||
acl_change_event_stasis_unsubscribe();
|
||||
|
||||
ast_sched_dump(sched);
|
||||
|
||||
/* First, take us out of the channel type list */
|
||||
ast_channel_unregister(&sip_tech);
|
||||
|
||||
ast_msg_tech_unregister(&sip_msg_tech);
|
||||
ast_cc_monitor_unregister(&sip_cc_monitor_callbacks);
|
||||
ast_cc_agent_unregister(&sip_cc_agent_callbacks);
|
||||
|
||||
/* Unregister dial plan functions */
|
||||
ast_custom_function_unregister(&sippeer_function);
|
||||
@@ -35351,8 +35352,6 @@ static int unload_module(void)
|
||||
}
|
||||
ao2_iterator_destroy(&i);
|
||||
|
||||
unlink_all_peers_from_tables();
|
||||
|
||||
ast_mutex_lock(&monlock);
|
||||
if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP) && (monitor_thread != AST_PTHREADT_NULL)) {
|
||||
pthread_t th = monitor_thread;
|
||||
@@ -35366,7 +35365,12 @@ static int unload_module(void)
|
||||
ast_mutex_unlock(&monlock);
|
||||
}
|
||||
|
||||
/* Clear containers */
|
||||
unlink_all_peers_from_tables();
|
||||
cleanup_all_regs();
|
||||
sip_epa_unregister_all();
|
||||
destroy_escs();
|
||||
clear_sip_domains();
|
||||
|
||||
{
|
||||
struct ao2_iterator iter;
|
||||
@@ -35395,25 +35399,6 @@ static int unload_module(void)
|
||||
*/
|
||||
ast_sched_runq(sched);
|
||||
|
||||
/* Free memory for local network address mask */
|
||||
ast_free_ha(localaddr);
|
||||
|
||||
ast_mutex_lock(&authl_lock);
|
||||
if (authl) {
|
||||
ao2_t_cleanup(authl, "Removing global authentication");
|
||||
authl = NULL;
|
||||
}
|
||||
ast_mutex_unlock(&authl_lock);
|
||||
|
||||
sip_epa_unregister_all();
|
||||
destroy_escs();
|
||||
|
||||
ast_free(default_tls_cfg.certfile);
|
||||
ast_free(default_tls_cfg.pvtfile);
|
||||
ast_free(default_tls_cfg.cipher);
|
||||
ast_free(default_tls_cfg.cafile);
|
||||
ast_free(default_tls_cfg.capath);
|
||||
|
||||
/*
|
||||
* Wait awhile for the TCP/TLS thread container to become empty.
|
||||
*
|
||||
@@ -35427,8 +35412,26 @@ static int unload_module(void)
|
||||
}
|
||||
if (ao2_container_count(threadt)) {
|
||||
ast_debug(2, "TCP/TLS thread container did not become empty :(\n");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Free memory for local network address mask */
|
||||
ast_free_ha(localaddr);
|
||||
|
||||
ast_mutex_lock(&authl_lock);
|
||||
if (authl) {
|
||||
ao2_t_cleanup(authl, "Removing global authentication");
|
||||
authl = NULL;
|
||||
}
|
||||
ast_mutex_unlock(&authl_lock);
|
||||
|
||||
ast_free(default_tls_cfg.certfile);
|
||||
ast_free(default_tls_cfg.pvtfile);
|
||||
ast_free(default_tls_cfg.cipher);
|
||||
ast_free(default_tls_cfg.cafile);
|
||||
ast_free(default_tls_cfg.capath);
|
||||
|
||||
ao2_cleanup(registry_list);
|
||||
ao2_cleanup(subscription_mwi_list);
|
||||
|
||||
@@ -35442,7 +35445,6 @@ static int unload_module(void)
|
||||
ao2_t_cleanup(threadt, "unref the thread table");
|
||||
ao2_t_cleanup(sip_monitor_instances, "unref the sip_monitor_instances table");
|
||||
|
||||
clear_sip_domains();
|
||||
sip_cfg.contact_acl = ast_free_acl_list(sip_cfg.contact_acl);
|
||||
if (sipsock_read_id) {
|
||||
ast_io_remove(io, sipsock_read_id);
|
||||
@@ -35455,8 +35457,6 @@ static int unload_module(void)
|
||||
ast_context_destroy_by_name(used_context, "SIP");
|
||||
ast_unload_realtime("sipregs");
|
||||
ast_unload_realtime("sippeers");
|
||||
ast_cc_monitor_unregister(&sip_cc_monitor_callbacks);
|
||||
ast_cc_agent_unregister(&sip_cc_agent_callbacks);
|
||||
|
||||
sip_reqresp_parser_exit();
|
||||
sip_unregister_tests();
|
||||
|
Reference in New Issue
Block a user