[asterisk-commits] rmudgett: branch 1.8 r377881 - /branches/1.8/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 11 15:54:26 CST 2012
Author: rmudgett
Date: Tue Dec 11 15:54:22 2012
New Revision: 377881
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=377881
Log:
Cleanup CLI commands on exit for several files.
(issue ASTERISK-20649)
Reported by: Corey Farrell
Patches:
unregister-cli-multiple-all.patch (license #5909) patch uploaded by Corey Farrell
Modified:
branches/1.8/main/aoc.c
branches/1.8/main/cel.c
branches/1.8/main/channel.c
branches/1.8/main/data.c
branches/1.8/main/file.c
branches/1.8/main/http.c
branches/1.8/main/image.c
branches/1.8/main/stun.c
branches/1.8/main/timing.c
Modified: branches/1.8/main/aoc.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/aoc.c?view=diff&rev=377881&r1=377880&r2=377881
==============================================================================
--- branches/1.8/main/aoc.c (original)
+++ branches/1.8/main/aoc.c Tue Dec 11 15:54:22 2012
@@ -1605,7 +1605,12 @@
AST_CLI_DEFINE(aoc_cli_debug_enable, "enable cli debugging of AOC messages"),
};
+static void aoc_shutdown(void)
+{
+ ast_cli_unregister_multiple(aoc_cli, ARRAY_LEN(aoc_cli));
+}
int ast_aoc_cli_init(void)
{
+ ast_register_atexit(aoc_shutdown);
return ast_cli_register_multiple(aoc_cli, ARRAY_LEN(aoc_cli));
}
Modified: branches/1.8/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/cel.c?view=diff&rev=377881&r1=377880&r2=377881
==============================================================================
--- branches/1.8/main/cel.c (original)
+++ branches/1.8/main/cel.c Tue Dec 11 15:54:22 2012
@@ -715,6 +715,7 @@
ao2_ref(linkedids, -1);
linkedids = NULL;
}
+ ast_cli_unregister(&cli_status);
}
int ast_cel_engine_init(void)
Modified: branches/1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/channel.c?view=diff&rev=377881&r1=377880&r2=377881
==============================================================================
--- branches/1.8/main/channel.c (original)
+++ branches/1.8/main/channel.c Tue Dec 11 15:54:22 2012
@@ -8109,6 +8109,7 @@
static void channels_shutdown(void)
{
ast_data_unregister(NULL);
+ ast_cli_unregister_multiple(cli_channel, ARRAY_LEN(cli_channel));
if (channels) {
ao2_ref(channels, -1);
channels = NULL;
Modified: branches/1.8/main/data.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/data.c?view=diff&rev=377881&r1=377880&r2=377881
==============================================================================
--- branches/1.8/main/data.c (original)
+++ branches/1.8/main/data.c Tue Dec 11 15:54:22 2012
@@ -3286,7 +3286,9 @@
static void data_shutdown(void)
{
ast_manager_unregister("DataGet");
+ ast_cli_unregister_multiple(cli_data, ARRAY_LEN(cli_data));
ao2_t_ref(root_data.container, -1, "Unref root_data.container in data_shutdown");
+ root_data.container = NULL;
ast_rwlock_destroy(&root_data.lock);
}
Modified: branches/1.8/main/file.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/file.c?view=diff&rev=377881&r1=377880&r2=377881
==============================================================================
--- branches/1.8/main/file.c (original)
+++ branches/1.8/main/file.c Tue Dec 11 15:54:22 2012
@@ -1492,8 +1492,14 @@
AST_CLI_DEFINE(handle_cli_core_show_file_formats, "Displays file formats")
};
+static void file_shutdown(void)
+{
+ ast_cli_unregister_multiple(cli_file, ARRAY_LEN(cli_file));
+}
+
int ast_file_init(void)
{
ast_cli_register_multiple(cli_file, ARRAY_LEN(cli_file));
+ ast_register_atexit(file_shutdown);
return 0;
}
Modified: branches/1.8/main/http.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/http.c?view=diff&rev=377881&r1=377880&r2=377881
==============================================================================
--- branches/1.8/main/http.c (original)
+++ branches/1.8/main/http.c Tue Dec 11 15:54:22 2012
@@ -1204,11 +1204,17 @@
AST_CLI_DEFINE(handle_show_http, "Display HTTP server status"),
};
+static void http_shutdown(void)
+{
+ ast_cli_unregister_multiple(cli_http, ARRAY_LEN(cli_http));
+}
+
int ast_http_init(void)
{
ast_http_uri_link(&statusuri);
ast_http_uri_link(&staticuri);
ast_cli_register_multiple(cli_http, ARRAY_LEN(cli_http));
+ ast_register_atexit(http_shutdown);
return __ast_http_load(0);
}
Modified: branches/1.8/main/image.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/image.c?view=diff&rev=377881&r1=377880&r2=377881
==============================================================================
--- branches/1.8/main/image.c (original)
+++ branches/1.8/main/image.c Tue Dec 11 15:54:22 2012
@@ -205,8 +205,14 @@
AST_CLI_DEFINE(handle_core_show_image_formats, "Displays image formats")
};
+static void image_shutdown(void)
+{
+ ast_cli_unregister_multiple(cli_image, ARRAY_LEN(cli_image));
+}
+
int ast_image_init(void)
{
ast_cli_register_multiple(cli_image, ARRAY_LEN(cli_image));
+ ast_register_atexit(image_shutdown);
return 0;
}
Modified: branches/1.8/main/stun.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/stun.c?view=diff&rev=377881&r1=377880&r2=377881
==============================================================================
--- branches/1.8/main/stun.c (original)
+++ branches/1.8/main/stun.c Tue Dec 11 15:54:22 2012
@@ -499,8 +499,14 @@
AST_CLI_DEFINE(handle_cli_stun_set_debug, "Enable/Disable STUN debugging"),
};
+static void stun_shutdown(void)
+{
+ ast_cli_unregister_multiple(cli_stun, sizeof(cli_stun) / sizeof(struct ast_cli_entry));
+}
+
/*! \brief Initialize the STUN system in Asterisk */
void ast_stun_init(void)
{
ast_cli_register_multiple(cli_stun, sizeof(cli_stun) / sizeof(struct ast_cli_entry));
-}
+ ast_register_atexit(stun_shutdown);
+}
Modified: branches/1.8/main/timing.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/timing.c?view=diff&rev=377881&r1=377880&r2=377881
==============================================================================
--- branches/1.8/main/timing.c (original)
+++ branches/1.8/main/timing.c Tue Dec 11 15:54:22 2012
@@ -299,11 +299,21 @@
AST_CLI_DEFINE(timing_test, "Run a timing test"),
};
+static void timing_shutdown(void)
+{
+ ast_cli_unregister_multiple(cli_timing, ARRAY_LEN(cli_timing));
+
+ ast_heap_destroy(timing_interfaces);
+ timing_interfaces = NULL;
+}
+
int ast_timing_init(void)
{
if (!(timing_interfaces = ast_heap_create(2, timing_holder_cmp, 0))) {
return -1;
}
+ ast_register_atexit(timing_shutdown);
+
return ast_cli_register_multiple(cli_timing, ARRAY_LEN(cli_timing));
}
More information about the asterisk-commits
mailing list