[asterisk-commits] rmudgett: branch 10 r366241 - in /branches/10: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 10 18:42:47 CDT 2012


Author: rmudgett
Date: Thu May 10 18:42:43 2012
New Revision: 366241

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=366241
Log:
* Made ast_change_name() hold the channels container lock while changing the channel name.

* Eliminate redundant list not empty check in clone_variables().
........

Merged revisions 366240 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/10/   (props changed)
    branches/10/main/channel.c

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/channel.c?view=diff&rev=366241&r1=366240&r2=366241
==============================================================================
--- branches/10/main/channel.c (original)
+++ branches/10/main/channel.c Thu May 10 18:42:43 2012
@@ -6321,11 +6321,13 @@
 void ast_change_name(struct ast_channel *chan, const char *newname)
 {
 	/* We must re-link, as the hash value will change here. */
+	ao2_lock(channels);
+	ast_channel_lock(chan);
 	ao2_unlink(channels, chan);
-	ast_channel_lock(chan);
 	__ast_change_name_nolink(chan, newname);
+	ao2_link(channels, chan);
 	ast_channel_unlock(chan);
-	ao2_link(channels, chan);
+	ao2_unlock(channels);
 }
 
 void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
@@ -6382,8 +6384,7 @@
 	struct ast_var_t *current, *newvar;
 	/* Append variables from clone channel into original channel */
 	/* XXX Is this always correct?  We have to in order to keep MACROS working XXX */
-	if (AST_LIST_FIRST(&clonechan->varshead))
-		AST_LIST_APPEND_LIST(&original->varshead, &clonechan->varshead, entries);
+	AST_LIST_APPEND_LIST(&original->varshead, &clonechan->varshead, entries);
 
 	/* then, dup the varshead list into the clone */
 	




More information about the asterisk-commits mailing list