Author: jrose
Date: Fri Jan 30 10:41:41 2015
New Revision: 431467

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=431467
Log:
Merge r431153 from asterisk/branches/13

  r431153 | jrose | 2015-01-27 11:22:52 -0600 (Tue, 27 Jan 2015) | 9 lines

  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


Modified:
    certified/branches/13.1/   (props changed)
    certified/branches/13.1/main/manager.c

Propchange: certified/branches/13.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jan 30 10:41:41 2015
@@ -1,1 +1,1 @@
-/branches/13:429273
+/branches/13:429273,431153

Modified: certified/branches/13.1/main/manager.c
URL: 
http://svnview.digium.com/svn/asterisk/certified/branches/13.1/main/manager.c?view=diff&rev=431467&r1=431466&r2=431467
==============================================================================
--- certified/branches/13.1/main/manager.c (original)
+++ certified/branches/13.1/main/manager.c Fri Jan 30 10:41:41 2015
@@ -6009,15 +6009,34 @@
                        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;
                        }
+
+                       return 0;
                } else {
                        ast_module_reload(NULL);        /* Reload all modules */
                        astman_send_ack(s, m, "All modules reloaded");


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to