diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-09-22 03:01:16 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-09-22 03:01:16 +0000 |
commit | 1d897e168500a1633164da1b23c5e586f28e625c (patch) | |
tree | 8bf0cdab4eb5f00ba0089456b917bf6a6f223177 /channels/chan_skinny.c | |
parent | d63196674d8c3a4e57f83e91ebadbe4c3af30a29 (diff) |
First shot at unload_module in chan_skinny..
More to come.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@43469 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r-- | channels/chan_skinny.c | 62 |
1 files changed, 25 insertions, 37 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index e42a29a2e..fba006d01 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -4549,52 +4549,40 @@ static int load_module(void) static int unload_module(void) { -#if 0 - struct skinnysession *s; + delete_devices(); - /* close all IP connections */ - if (!ast_mutex_lock(&devicelock)) { - /* Terminate tcp listener thread */ - } else { - ast_log(LOG_WARNING, "Unable to lock the monitor\n"); - return -1; - } - if (!ast_mutex_lock(&monlock)) { - if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) { - pthread_cancel(monitor_thread); - pthread_kill(monitor_thread, SIGURG); - pthread_join(monitor_thread, NULL); - } - monitor_thread = AST_PTHREADT_STOP; - ast_mutex_unlock(&monlock); - } else { - ast_log(LOG_WARNING, "Unable to lock the monitor\n"); - return -1; + ast_mutex_lock(&monlock); + if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) { + pthread_cancel(monitor_thread); + pthread_kill(monitor_thread, SIGURG); + pthread_join(monitor_thread, NULL); } - if (!ast_mutex_lock(&iflock)) { - /* Destroy all the interfaces and free their memory */ - p = iflist; - while(p) { - pl = p; - p = p->next; - /* Free associated memory */ - ast_mutex_destroy(&pl->lock); - free(pl); - } - iflist = NULL; - ast_mutex_unlock(&iflock); - } else { - ast_log(LOG_WARNING, "Unable to lock the monitor\n"); - return -1; + monitor_thread = AST_PTHREADT_STOP; + ast_mutex_unlock(&monlock); + +#if 0 /* XXX This is...funky. Will fix shortly */ + ast_mutex_lock(&sessionlock); + /* Destroy all the interfaces and free their memory */ + p = iflist; + while(p) { + pl = p; + p = p->next; + /* Free associated memory */ + ast_mutex_destroy(&pl->lock); + free(pl); } + iflist = NULL; + ast_mutex_unlock(&sessionlock); +#endif ast_rtp_proto_unregister(&skinny_rtp); ast_channel_unregister(&skinny_tech); ast_cli_unregister_multiple(cli_skinny, sizeof(cli_skinny) / sizeof(struct ast_cli_entry)); + close(skinnysock); + sched_context_destroy(sched); + return 0; -#endif - return -1; } AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Skinny Client Control Protocol (Skinny)", |