[svn-commits] qwell: branch qwell/ari_channel_variables r393492 - in /team/qwell/ari_channe...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 2 16:09:53 CDT 2013


Author: qwell
Date: Tue Jul  2 16:09:51 2013
New Revision: 393492

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393492
Log:
Multiple revisions 393489-393490

........
  r393489 | rmudgett | 2013-07-02 15:56:13 -0500 (Tue, 02 Jul 2013) | 2 lines
  
  MixMonitor: Remove some unnecessary channel locking.
........
  r393490 | rmudgett | 2013-07-02 16:01:23 -0500 (Tue, 02 Jul 2013) | 2 lines
  
  MixMonitor: Fix refleak in manager_stop_mixmonitor() if could not stop monitoring.
........

Merged revisions 393489-393490 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/qwell/ari_channel_variables/   (props changed)
    team/qwell/ari_channel_variables/apps/app_mixmonitor.c

Propchange: team/qwell/ari_channel_variables/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jul  2 16:09:51 2013
@@ -1,1 +1,1 @@
-/trunk:1-393487
+/trunk:1-393491

Modified: team/qwell/ari_channel_variables/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_variables/apps/app_mixmonitor.c?view=diff&rev=393492&r1=393491&r2=393492
==============================================================================
--- team/qwell/ari_channel_variables/apps/app_mixmonitor.c (original)
+++ team/qwell/ari_channel_variables/apps/app_mixmonitor.c Tue Jul  2 16:09:51 2013
@@ -810,7 +810,9 @@
 				*p2 = '$';
 			}
 		}
+		ast_channel_lock(chan);
 		pbx_substitute_variables_helper(chan, p1, postprocess2, sizeof(postprocess2) - 1);
+		ast_channel_unlock(chan);
 	}
 
 	/* Pre-allocate mixmonitor structure and spy */
@@ -1144,17 +1146,14 @@
 		return CLI_SUCCESS;
 	}
 
-	ast_channel_lock(chan);
-
 	if (!strcasecmp(a->argv[1], "start")) {
 		mixmonitor_exec(chan, (a->argc >= 4) ? a->argv[3] : "");
-		ast_channel_unlock(chan);
 	} else if (!strcasecmp(a->argv[1], "stop")){
-		ast_channel_unlock(chan);
 		stop_mixmonitor_exec(chan, (a->argc >= 4) ? a->argv[3] : "");
 	} else if (!strcasecmp(a->argv[1], "list")) {
 		ast_cli(a->fd, "MixMonitor ID\tFile\tReceive File\tTransmit File\n");
 		ast_cli(a->fd, "=========================================================================\n");
+		ast_channel_lock(chan);
 		AST_LIST_TRAVERSE(ast_channel_datastores(chan), datastore, entry) {
 			if (datastore->info == &mixmonitor_ds_info) {
 				char *filename = "";
@@ -1172,7 +1171,6 @@
 		}
 		ast_channel_unlock(chan);
 	} else {
-		ast_channel_unlock(chan);
 		chan = ast_channel_unref(chan);
 		return CLI_SHOWUSAGE;
 	}
@@ -1254,7 +1252,6 @@
 	char *opts[OPT_ARG_ARRAY_SIZE] = { NULL, };
 	struct ast_flags flags = { 0 };
 	char args[PATH_MAX] = "";
-	int res;
 
 	if (!ast_strlen_zero(options)) {
 		ast_app_parse_options(mixmonitor_opts, &flags, opts, ast_strdupa(options));
@@ -1262,11 +1259,7 @@
 
 	snprintf(args, sizeof(args), "%s,%s", filename, options);
 
-	ast_channel_lock(chan);
-	res = mixmonitor_exec(chan, args);
-	ast_channel_unlock(chan);
-
-	return res;
+	return mixmonitor_exec(chan, args);
 }
 
 static int stop_mixmonitor_callback(struct ast_channel *chan, const char *mixmonitor_id)
@@ -1307,14 +1300,15 @@
 
 	snprintf(args, sizeof(args), "%s,%s", file, options);
 
-	ast_channel_lock(c);
 	res = mixmonitor_exec(c, args);
 
 	if (ast_test_flag(&flags, MUXFLAG_UID)) {
 		uid_channel_var = opts[OPT_ARG_UID];
+		ast_channel_lock(c);
 		mixmonitor_id = pbx_builtin_getvar_helper(c, uid_channel_var);
-	}
-	ast_channel_unlock(c);
+		mixmonitor_id = ast_strdupa(S_OR(mixmonitor_id, ""));
+		ast_channel_unlock(c);
+	}
 
 	if (res) {
 		c = ast_channel_unref(c);
@@ -1363,6 +1357,7 @@
 	res = stop_mixmonitor_full(c, mixmonitor_id);
 
 	if (res) {
+		ast_channel_unref(c);
 		astman_send_error(s, m, "Could not stop monitoring channel");
 		return AMI_SUCCESS;
 	}




More information about the svn-commits mailing list