[svn-commits] jrose: trunk r431201 - in /trunk: ./ main/manager.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jan 27 13:31:32 CST 2015


Author: jrose
Date: Tue Jan 27 13:31:29 2015
New Revision: 431201

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=431201
Log:
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/
........

Merged revisions 431153 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    trunk/   (props changed)
    trunk/main/manager.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager.c?view=diff&rev=431201&r1=431200&r2=431201
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Tue Jan 27 13:31:29 2015
@@ -6043,14 +6043,31 @@
 			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 */




More information about the svn-commits mailing list