[asterisk-commits] russell: branch russell/ast_channel_ao2 r183816 - /team/russell/ast_channel_a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 23 15:52:04 CDT 2009


Author: russell
Date: Mon Mar 23 15:52:01 2009
New Revision: 183816

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183816
Log:
Be more explicit about where the channel lock is needed

Modified:
    team/russell/ast_channel_ao2/res/res_monitor.c

Modified: team/russell/ast_channel_ao2/res/res_monitor.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/res/res_monitor.c?view=diff&rev=183816&r1=183815&r2=183816
==============================================================================
--- team/russell/ast_channel_ao2/res/res_monitor.c (original)
+++ team/russell/ast_channel_ao2/res/res_monitor.c Mon Mar 23 15:52:01 2009
@@ -585,11 +585,11 @@
 		return 0;
 	}
 
-	ast_channel_lock(c);
-
 	if (ast_strlen_zero(fname)) {
 		/* No filename base specified, default to channel name as per CLI */
+		ast_channel_lock(c);
 		fname = ast_strdupa(c->name);
+		ast_channel_unlock(c);
 		/* Channels have the format technology/channel_name - have to replace that /  */
 		if ((d = strchr(fname, '/'))) {
 			*d = '-';
@@ -599,17 +599,17 @@
 	if (ast_monitor_start(c, format, fname, 1, X_REC_IN | X_REC_OUT)) {
 		if (ast_monitor_change_fname(c, fname, 1)) {
 			astman_send_error(s, m, "Could not start monitoring channel");
-			ast_channel_unlock(c);
 			c = ast_channel_unref(c);
 			return 0;
 		}
 	}
 
 	if (ast_true(mix)) {
+		ast_channel_lock(c);
 		ast_monitor_setjoinfiles(c, 1);
-	}
-
-	ast_channel_unlock(c);
+		ast_channel_unlock(c);
+	}
+
 	c = ast_channel_unref(c);
 
 	astman_send_ack(s, m, "Started monitoring channel");




More information about the asterisk-commits mailing list