[asterisk-dev] [Code Review] 4354: Bridge core: Pass a ref with the swap channel when joining a bridge.

Matt Jordan reviewboard at asterisk.org
Mon Jan 19 16:24:33 CST 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4354/#review14233
-----------------------------------------------------------



/branches/13/include/asterisk/bridge.h
<https://reviewboard.asterisk.org/r/4354/#comment24695>

    Why is it not a good idea for the caller to have their own reference, if they bump the reference to cover the stealing by this function?
    
    That is, why is the following unsafe:
    
    swap = ast_channel_find(...);
    
    ast_channel_ref(swap);
    ast_bridge_join(bridge, chan, swap);
    
    



/branches/13/main/bridge.c
<https://reviewboard.asterisk.org/r/4354/#comment24696>

    I don't think the join actually failed here. This should just get called when bridge_channel_internal_join returns, which could occur when the channel was released from the bridge. If I'm wrong, feel free to disregard :-)



/branches/13/main/bridge.c
<https://reviewboard.asterisk.org/r/4354/#comment24697>

    Same finding here.



/branches/13/main/bridge.c
<https://reviewboard.asterisk.org/r/4354/#comment24698>

    And here.


- Matt Jordan


On Jan. 19, 2015, 2:31 p.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4354/
> -----------------------------------------------------------
> 
> (Updated Jan. 19, 2015, 2:31 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24649
>     https://issues.asterisk.org/jira/browse/ASTERISK-24649
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> When code imparts a channel into a bridge to swap with another channel, a ref needs to be held on the swap channel to ensure that it cannot dissapear before finding it in the bridge.
> 
> * The ast_bridge_join() swap channel parameter now always steals a ref for the swap channel.  This is the only change to the bridge framework's public API semantics.
> 
> * bridge_channel_internal_join() now requires the bridge_channel->swap channel to pass in a ref.
> 
> 
> Diffs
> -----
> 
>   /branches/13/main/bridge_channel.c 430794 
>   /branches/13/main/bridge.c 430794 
>   /branches/13/include/asterisk/bridge_internal.h 430794 
>   /branches/13/include/asterisk/bridge_channel_internal.h 430794 
>   /branches/13/include/asterisk/bridge.h 430794 
> 
> Diff: https://reviewboard.asterisk.org/r/4354/diff/
> 
> 
> Testing
> -------
> 
> The testsutite masquerade super test and the --tags=transfer tests still pass.
> 
> 
> Thanks,
> 
> rmudgett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150119/096be94b/attachment.html>


More information about the asterisk-dev mailing list