[asterisk-dev] [Code Review] 2721: bridge_channels: Add support for the lonely flag
David Lee
reviewboard at asterisk.org
Thu Aug 1 11:04:10 CDT 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2721/#review9285
-----------------------------------------------------------
/trunk/main/bridge_channel.c
<https://reviewboard.asterisk.org/r/2721/#comment18291>
This loop works in O(n) every time a channel is removed from a bridge. But since all n channels will eventually be removed from the bridge, this loop will have an effective cost of O(n^2) removing all channels from a bridge. For even a moderate number of channels in a bridge, this could be a big performance problem.
It may be better to count lonely channels as they are added/removed from the bridge, assuming that a channel can't become lonely/unlonely once it's in a bridge.
/trunk/main/bridge_channel.c
<https://reviewboard.asterisk.org/r/2721/#comment18288>
bridge_channel_internal_pull() and bridge_channel_dissolve_check() are co-recursive. The code might actually work, just accidentally.
The internal_pull() function removes other from bridge->channels, which causes the loop to terminate early. The loop only pulls the first channel from the bridge.
But since internal_pull() calls dissolve_check(), it will recursively pull the first channel from the bridge until all the channels have been removed.
With enough lonely channels in a bridge, this could blow the stack.
- David Lee
On July 31, 2013, 12:31 p.m., jrose wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2721/
> -----------------------------------------------------------
>
> (Updated July 31, 2013, 12:31 p.m.)
>
>
> Review request for Asterisk Developers, David Lee, Matt Jordan, and rmudgett.
>
>
> Bugs: ASTERISK-22117
> https://issues.asterisk.org/jira/browse/ASTERISK-22117
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> Channels with the lonely flag are supposed to leave a bridge if all of the channels in that bridge are also lonely at the time of a channel dissolving.
> I also added this flag to ARI play and record on bridge channels.
>
>
> Diffs
> -----
>
> /trunk/main/core_unreal.c 395852
> /trunk/res/ari/resource_bridges.c 395852
> /trunk/include/asterisk/core_unreal.h 395852
> /trunk/main/bridge_channel.c 395852
>
> Diff: https://reviewboard.asterisk.org/r/2721/diff/
>
>
> Testing
> -------
>
> Tested what happens to channels when a non-lonely channel leaves with and without the presence of non-lonely channels.
> If only lonely channels were left, they hung up. This did produce an ARI playback error since the channel playback was interrupted.
> If non-lonely channels were left, nothing would happen as anticipated.
>
>
> Thanks,
>
> jrose
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130801/a0726ab4/attachment.htm>
More information about the asterisk-dev
mailing list