Merge "cdr_mysql: Don't clean up on unload unless we can unregister from CDRs" into 16

This commit is contained in:
George Joseph 2019-10-08 08:24:40 -05:00 committed by Gerrit Code Review
commit ff293d0ff0
1 changed files with 9 additions and 1 deletions

View File

@ -382,6 +382,13 @@ static int my_unload_module(int reload)
{
struct column *entry;
if (!reload) {
if (ast_cdr_unregister(name)) {
/* If we can't unregister the backend, we can't unload the module */
return -1;
}
}
ast_cli_unregister_multiple(cdr_mysql_status_cli, sizeof(cdr_mysql_status_cli) / sizeof(struct ast_cli_entry));
if (connected) {
@ -406,7 +413,8 @@ static int my_unload_module(int reload)
if (reload) {
return ast_cdr_backend_suspend(name);
} else {
return ast_cdr_unregister(name);
/* We unregistered earlier */
return 0;
}
}