mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-06 01:45:11 +00:00
Fix deadlock between bridged channels that attempt to set the hangup source
Calling ast_set_hangupsource with the channel lock held can result in a deadlock because the function also locks the bridged channel. (issue AST-891) git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@369848 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2720,12 +2720,18 @@ void ast_set_hangupsource(struct ast_channel *chan, const char *source, int forc
|
||||
ast_string_field_set(chan, hangupsource, source);
|
||||
}
|
||||
bridge = ast_bridged_channel(chan);
|
||||
if (bridge) {
|
||||
ast_channel_ref(bridge);
|
||||
}
|
||||
ast_channel_unlock(chan);
|
||||
|
||||
if (bridge && (force || ast_strlen_zero(bridge->hangupsource))) {
|
||||
if (bridge) {
|
||||
ast_channel_lock(bridge);
|
||||
ast_string_field_set(chan, hangupsource, source);
|
||||
if (force || ast_strlen_zero(bridge->hangupsource)) {
|
||||
ast_string_field_set(bridge, hangupsource, source);
|
||||
}
|
||||
ast_channel_unlock(bridge);
|
||||
ast_channel_unref(bridge);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user