diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-17 16:42:21 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-17 16:42:21 +0000 |
commit | 2f4660a236080dac4740887e276208c4a12c743c (patch) | |
tree | 69bea73175a4ad33bd963b1f0c97c206b89a33ab /channels | |
parent | 34fbed82538f271aae21f2dfd53f27d2bc824f18 (diff) |
more module loader related fixes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@20963 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_alsa.c | 10 | ||||
-rw-r--r-- | channels/chan_misdn.c | 90 | ||||
-rw-r--r-- | channels/chan_nbs.c | 10 | ||||
-rw-r--r-- | channels/chan_vpb.c | 132 |
4 files changed, 121 insertions, 121 deletions
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index 9714c3ff5..b2bc270fb 100644 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -1042,7 +1042,7 @@ static struct ast_cli_entry myclis[] = { { { "autoanswer", NULL }, console_autoanswer, "Sets/displays autoanswer", autoanswer_usage, autoanswer_complete } }; -int load_module() +int load_module(void) { int res; int x; @@ -1103,7 +1103,7 @@ int load_module() -int unload_module() +int unload_module(void) { int x; @@ -1125,17 +1125,17 @@ int unload_module() return 0; } -const char *description() +const char *description(void) { return (char *) desc; } -int usecount() +int usecount(void) { return usecnt; } -const char *key() +const char *key(void) { return ASTERISK_GPL_KEY; } diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index 08e9d55af..b5a6499cc 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -3827,6 +3827,51 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) static int g_config_initialized=0; +int unload_module(void) +{ + /* First, take us out of the channel loop */ + ast_log(LOG_VERBOSE, "-- Unregistering mISDN Channel Driver --\n"); + + if (!g_config_initialized) return 0; + + ast_cli_unregister(&cli_send_display); + + ast_cli_unregister(&cli_send_cd); + + ast_cli_unregister(&cli_send_digit); + ast_cli_unregister(&cli_toggle_echocancel); + ast_cli_unregister(&cli_set_tics); + + ast_cli_unregister(&cli_show_cls); + ast_cli_unregister(&cli_show_cl); + ast_cli_unregister(&cli_show_config); + ast_cli_unregister(&cli_show_port); + ast_cli_unregister(&cli_show_stacks); + ast_cli_unregister(&cli_restart_port); + ast_cli_unregister(&cli_port_up); + ast_cli_unregister(&cli_port_down); + ast_cli_unregister(&cli_set_debug); + ast_cli_unregister(&cli_set_crypt_debug); + ast_cli_unregister(&cli_reload); + /* ast_unregister_application("misdn_crypt"); */ + ast_unregister_application("misdn_set_opt"); + ast_unregister_application("misdn_facility"); + + ast_channel_unregister(&misdn_tech); + + + free_robin_list(); + misdn_cfg_destroy(); + misdn_lib_destroy(); + + if (misdn_debug) + free(misdn_debug); + if (misdn_debug_only) + free(misdn_debug_only); + + return 0; +} + int load_module(void) { int i; @@ -3934,51 +3979,6 @@ int load_module(void) -int unload_module(void) -{ - /* First, take us out of the channel loop */ - ast_log(LOG_VERBOSE, "-- Unregistering mISDN Channel Driver --\n"); - - if (!g_config_initialized) return 0; - - ast_cli_unregister(&cli_send_display); - - ast_cli_unregister(&cli_send_cd); - - ast_cli_unregister(&cli_send_digit); - ast_cli_unregister(&cli_toggle_echocancel); - ast_cli_unregister(&cli_set_tics); - - ast_cli_unregister(&cli_show_cls); - ast_cli_unregister(&cli_show_cl); - ast_cli_unregister(&cli_show_config); - ast_cli_unregister(&cli_show_port); - ast_cli_unregister(&cli_show_stacks); - ast_cli_unregister(&cli_restart_port); - ast_cli_unregister(&cli_port_up); - ast_cli_unregister(&cli_port_down); - ast_cli_unregister(&cli_set_debug); - ast_cli_unregister(&cli_set_crypt_debug); - ast_cli_unregister(&cli_reload); - /* ast_unregister_application("misdn_crypt"); */ - ast_unregister_application("misdn_set_opt"); - ast_unregister_application("misdn_facility"); - - ast_channel_unregister(&misdn_tech); - - - free_robin_list(); - misdn_cfg_destroy(); - misdn_lib_destroy(); - - if (misdn_debug) - free(misdn_debug); - if (misdn_debug_only) - free(misdn_debug_only); - - return 0; -} - int reload(void) { reload_config(); diff --git a/channels/chan_nbs.c b/channels/chan_nbs.c index 0be2be73e..ee6f317bc 100644 --- a/channels/chan_nbs.c +++ b/channels/chan_nbs.c @@ -1,7 +1,7 @@ /* * Asterisk -- An open source telephony toolkit. * - * Copyright (C) 1999 - 2005, Digium, Inc. + * Copyright (C) 1999 - 2006, Digium, Inc. * * Mark Spencer <markster@digium.com> * @@ -297,7 +297,7 @@ int unload_module(void) return __unload_module(); } -int load_module() +int load_module(void) { /* Make sure we can register our channel type */ if (ast_channel_register(&nbs_tech)) { @@ -308,17 +308,17 @@ int load_module() return 0; } -int usecount() +int usecount(void) { return usecnt; } -const char *description() +const char *description(void) { return (char *) desc; } -const char *key() +const char *key(void) { return ASTERISK_GPL_KEY; } diff --git a/channels/chan_vpb.c b/channels/chan_vpb.c index e408718a7..af55eda57 100644 --- a/channels/chan_vpb.c +++ b/channels/chan_vpb.c @@ -2773,6 +2773,72 @@ static float parse_gain_value(char *gain_type, char *value) return gain; } + +int unload_module() +{ + struct vpb_pvt *p; + /* First, take us out of the channel loop */ + if (use_ast_ind == 1){ + ast_channel_unregister(&vpb_tech_indicate); + } + else { + ast_channel_unregister(&vpb_tech); + } + + ast_mutex_lock(&iflock); { + /* Hangup all interfaces if they have an owner */ + p = iflist; + while(p) { + if (p->owner) + ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD); + p = p->next; + } + iflist = NULL; + } ast_mutex_unlock(&iflock); + + ast_mutex_lock(&monlock); { + if (mthreadactive > -1) { + pthread_cancel(monitor_thread); + pthread_join(monitor_thread, NULL); + } + mthreadactive = -2; + } ast_mutex_unlock(&monlock); + + ast_mutex_lock(&iflock); { + /* Destroy all the interfaces and free their memory */ + + while(iflist) { + p = iflist; + ast_mutex_destroy(&p->lock); + pthread_cancel(p->readthread); + ast_mutex_destroy(&p->owner_lock); + ast_mutex_destroy(&p->record_lock); + ast_mutex_destroy(&p->play_lock); + ast_mutex_destroy(&p->play_dtmf_lock); + p->readthread = 0; + + vpb_close(p->handle); + + iflist = iflist->next; + + free(p); + } + iflist = NULL; + } ast_mutex_unlock(&iflock); + + ast_mutex_lock(&bridge_lock); { + memset(bridges, 0, sizeof bridges); + } ast_mutex_unlock(&bridge_lock); + ast_mutex_destroy(&bridge_lock); + for(int i = 0; i < max_bridges; i++ ) { + ast_mutex_destroy(&bridges[i].lock); + ast_cond_destroy(&bridges[i].cond); + } + free(bridges); + + return 0; +} + int load_module() { struct ast_config *cfg; @@ -2969,72 +3035,6 @@ int load_module() return error; } - -int unload_module() -{ - struct vpb_pvt *p; - /* First, take us out of the channel loop */ - if (use_ast_ind == 1){ - ast_channel_unregister(&vpb_tech_indicate); - } - else { - ast_channel_unregister(&vpb_tech); - } - - ast_mutex_lock(&iflock); { - /* Hangup all interfaces if they have an owner */ - p = iflist; - while(p) { - if (p->owner) - ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD); - p = p->next; - } - iflist = NULL; - } ast_mutex_unlock(&iflock); - - ast_mutex_lock(&monlock); { - if (mthreadactive > -1) { - pthread_cancel(monitor_thread); - pthread_join(monitor_thread, NULL); - } - mthreadactive = -2; - } ast_mutex_unlock(&monlock); - - ast_mutex_lock(&iflock); { - /* Destroy all the interfaces and free their memory */ - - while(iflist) { - p = iflist; - ast_mutex_destroy(&p->lock); - pthread_cancel(p->readthread); - ast_mutex_destroy(&p->owner_lock); - ast_mutex_destroy(&p->record_lock); - ast_mutex_destroy(&p->play_lock); - ast_mutex_destroy(&p->play_dtmf_lock); - p->readthread = 0; - - vpb_close(p->handle); - - iflist = iflist->next; - - free(p); - } - iflist = NULL; - } ast_mutex_unlock(&iflock); - - ast_mutex_lock(&bridge_lock); { - memset(bridges, 0, sizeof bridges); - } ast_mutex_unlock(&bridge_lock); - ast_mutex_destroy(&bridge_lock); - for(int i = 0; i < max_bridges; i++ ) { - ast_mutex_destroy(&bridges[i].lock); - ast_cond_destroy(&bridges[i].cond); - } - free(bridges); - - return 0; -} - int usecount() { return usecnt; |