[asterisk-commits] file: trunk r43455 - in /trunk: ./ channels/chan_mgcp.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Sep 21 15:14:31 MST 2006


Author: file
Date: Thu Sep 21 17:14:31 2006
New Revision: 43455

URL: http://svn.digium.com/view/asterisk?rev=43455&view=rev
Log:
Merged revisions 43454 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43454 | file | 2006-09-21 18:12:09 -0400 (Thu, 21 Sep 2006) | 2 lines

Clean up chan_mgcp's module load function (issue #8001 reported by Mithraen with mods by moi)

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_mgcp.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-1.4-merged (original)
+++ branch-1.4-merged Thu Sep 21 17:14:31 2006
@@ -1,1 +1,1 @@
-/branches/1.4:1-43376,43383,43386,43388,43392,43396,43405,43410,43422,43441,43445,43450
+/branches/1.4:1-43376,43383,43386,43388,43392,43396,43405,43410,43422,43441,43445,43450,43454

Modified: trunk/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_mgcp.c?rev=43455&r1=43454&r2=43455&view=diff
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Thu Sep 21 17:14:31 2006
@@ -4242,34 +4242,35 @@
 /*! \brief  load_module: PBX load module - initialization ---*/
 static int load_module(void)
 {
-	int res;
-
-	sched = sched_context_create();
-	if (!sched) {
+	if (!(sched = sched_context_create())) {
 		ast_log(LOG_WARNING, "Unable to create schedule context\n");
-		return -1;
-	}
-	io = io_context_create();
-	if (!io) {
+		return AST_MODULE_LOAD_FAILURE;
+	}
+
+	if (!(io = io_context_create())) {
 		ast_log(LOG_WARNING, "Unable to create I/O context\n");
-		return -1;
-	}
-
-	if (!(res = reload_config())) {
-		/* Make sure we can register our mgcp channel type */
-		if (ast_channel_register(&mgcp_tech)) {
-			ast_log(LOG_ERROR, "Unable to register channel class 'MGCP'\n");
-			return -1;
-		}
-		ast_rtp_proto_register(&mgcp_rtp);
-		ast_cli_register_multiple(cli_mgcp, sizeof(cli_mgcp) / sizeof(struct ast_cli_entry));
-
-		/* And start the monitor for the first time */
-		restart_monitor();
-	} else
+		sched_context_destroy(sched);
+		return AST_MODULE_LOAD_FAILURE;
+	}
+
+	if (reload_config())
 		return AST_MODULE_LOAD_DECLINE;
 
-	return res;
+	/* Make sure we can register our mgcp channel type */
+	if (ast_channel_register(&mgcp_tech)) {
+		ast_log(LOG_ERROR, "Unable to register channel class 'MGCP'\n");
+		io_context_destroy(io);
+		sched_context_destroy(sched);
+		return AST_MODULE_LOAD_FAILURE;
+	}
+
+	ast_rtp_proto_register(&mgcp_rtp);
+	ast_cli_register_multiple(cli_mgcp, sizeof(cli_mgcp) / sizeof(struct ast_cli_entry));
+	
+	/* And start the monitor for the first time */
+	restart_monitor();
+
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 /*! \brief  mgcp_do_reload: Reload module */



More information about the asterisk-commits mailing list