summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2015-01-27 19:31:29 +0000
committerJonathan Rose <jrose@digium.com>2015-01-27 19:31:29 +0000
commite826cb8a26a71af45771026325145cd442dd6077 (patch)
tree419517b35c9a4bcd8128871ec75ee364fe2aa095
parent3b0f03ef7b2787b406a735912e7b9a9c26b2d6b6 (diff)
Manager: Fix Manager Action ModuleLoad to give correct response when reloading
Prior to this patch, ModuleLoad would respond with an error indicating that the requested module wasn't found in spite of finding and reloading the module. Review: https://reviewboard.asterisk.org/r/4373/ ASTERISK-24721 #close ........ Merged revisions 431153 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--main/manager.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/main/manager.c b/main/manager.c
index 0ed0fef3a..783a704de 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -6043,14 +6043,31 @@ static int manager_moduleload(struct mansession *s, const struct message *m)
astman_send_ack(s, m, "Module unloaded.");
}
} else if (!strcasecmp(loadtype, "reload")) {
+ /* TODO: Unify the ack/error messages here with action_reload */
if (!ast_strlen_zero(module)) {
- res = ast_module_reload(module);
- if (res == 0) {
+ enum ast_module_reload_result reload_res = ast_module_reload(module);
+
+ switch (reload_res) {
+ case AST_MODULE_RELOAD_NOT_FOUND:
astman_send_error(s, m, "No such module.");
- } else if (res == 1) {
+ break;
+ case AST_MODULE_RELOAD_NOT_IMPLEMENTED:
astman_send_error(s, m, "Module does not support reload action.");
- } else {
+ break;
+ case AST_MODULE_RELOAD_ERROR:
+ astman_send_error(s, m, "An unknown error occurred");
+ break;
+ case AST_MODULE_RELOAD_IN_PROGRESS:
+ astman_send_error(s, m, "A reload is in progress");
+ break;
+ case AST_MODULE_RELOAD_UNINITIALIZED:
+ astman_send_error(s, m, "Module not initialized");
+ break;
+ case AST_MODULE_RELOAD_QUEUED:
+ case AST_MODULE_RELOAD_SUCCESS:
+ /* Treat a queued request as success */
astman_send_ack(s, m, "Module reloaded.");
+ break;
}
} else {
ast_module_reload(NULL); /* Reload all modules */