diff options
author | Richard Mudgett <rmudgett@digium.com> | 2012-05-10 23:49:07 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2012-05-10 23:49:07 +0000 |
commit | 2161d6870cd59c3ddd7f6334152989dc17a1732d (patch) | |
tree | b13458230ff9499ae9caa0d6e15bd22cb132e05a | |
parent | 098f74dd4e0c00ca0c5d95f31c6860ac15f2d3d5 (diff) |
* 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
........
Merged revisions 366241 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366242 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | main/channel.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/main/channel.c b/main/channel.c index c00ffb536..dfb31e1f3 100644 --- a/main/channel.c +++ b/main/channel.c @@ -6167,11 +6167,13 @@ static void __ast_change_name_nolink(struct ast_channel *chan, const char *newna void ast_change_name(struct ast_channel *chan, const char *newname) { /* We must re-link, as the hash value will change here. */ - ao2_unlink(channels, chan); + ao2_lock(channels); ast_channel_lock(chan); + ao2_unlink(channels, chan); __ast_change_name_nolink(chan, newname); - ast_channel_unlock(chan); ao2_link(channels, chan); + ast_channel_unlock(chan); + ao2_unlock(channels); } void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child) @@ -6228,8 +6230,7 @@ static void clone_variables(struct ast_channel *original, struct ast_channel *cl 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(ast_channel_varshead(clonechan))) - AST_LIST_APPEND_LIST(ast_channel_varshead(original), ast_channel_varshead(clonechan), entries); + AST_LIST_APPEND_LIST(ast_channel_varshead(original), ast_channel_varshead(clonechan), entries); /* then, dup the varshead list into the clone */ |