]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_musiconhold: Prevent multiple simultaneous reloads. 02/2002/2
authorSean Bright <sean.bright@gmail.com>
Wed, 13 Jan 2016 13:20:24 +0000 (08:20 -0500)
committerSean Bright <sean.bright@gmail.com>
Wed, 13 Jan 2016 13:50:29 +0000 (07:50 -0600)
There are two ways in which the reload() function in res_musiconhold can be
called from the CLI:

  * module reload res_musiconhold.so
  * moh reload

In the former case, the module loader holds a lock that prevents multiple
concurrent calls, but in the latter there is no such protection.

This patch changes the 'moh reload' CLI command to invoke the module loader
directly, rather than call reload() explicitly.

ASTERISK-25687 #close

Change-Id: I408968b4c8932864411b7f9ad88cfdc7b9ba711c

res/res_musiconhold.c

index bf7635ea27faa1ea5da86e305f8322008488ed25..4e5056358fba5fe34b2cd6566adfa558d9b86ac7 100644 (file)
@@ -1808,7 +1808,8 @@ static char *handle_cli_moh_reload(struct ast_cli_entry *e, int cmd, struct ast_
        if (a->argc != e->args)
                return CLI_SHOWUSAGE;
 
-       reload();
+       /* The module loader will prevent concurrent reloads from occurring, so we delegate */
+       ast_module_reload("res_musiconhold");
 
        return CLI_SUCCESS;
 }