[asterisk-commits] res musiconhold: Prevent multiple simultaneous reloads. (asterisk[11])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 13 09:32:29 CST 2016


Mark Michelson has submitted this change and it was merged.

Change subject: res_musiconhold: Prevent multiple simultaneous reloads.
......................................................................


res_musiconhold: Prevent multiple simultaneous reloads.

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
---
M res/res_musiconhold.c
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 9172473..1002633 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -67,6 +67,9 @@
 #include "asterisk/time.h"
 #include "asterisk/poll-compat.h"
 
+/* In order to gain access to ast_module_reload in 11 you need to include _private.h */
+#include "asterisk/_private.h"
+
 #define INITIAL_NUM_FILES   8
 #define HANDLE_REF	1
 #define DONT_UNREF	0
@@ -1836,7 +1839,8 @@
 	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;
 }

-- 
To view, visit https://gerrit.asterisk.org/2000
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I408968b4c8932864411b7f9ad88cfdc7b9ba711c
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list