]> git.ipfire.org Git - thirdparty/asterisk.git/commit
stasis transfer: fix a race condition on stasis bridge push 64/2664/1
authorScott Griepentrog <sgriepentrog@digium.com>
Thu, 22 Jan 2015 18:09:35 +0000 (18:09 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 20 Apr 2016 21:51:41 +0000 (16:51 -0500)
commita38d044e0a537e61f69ba0e6725a3984f6aa509d
treec683dc1b9d3ec38911e192ba978f011fabf4bc43
parentbc0a8c7bac087c75657db5fccb33829a6db7bf21
stasis transfer: fix a race condition on stasis bridge push

After a bridge transfer completes where a local replacement
channel is used, a stasis transfer message with the details
of the transfer is sent.  This is processed by stasis which
then sets the stasis app name and replaced channel snapshot
on the replacement channel.

However, since a separate thread was already started to run
stasis on the new replacement channel, a race was on to see
if the message processing would be completed before the app
name was needed, otherwise the channel would be hung up.

This change moves the calls used to set the stasis app name
and the replace snapshot to the bridge_stasis_push function
callback from the bridge transfer logic, allowing the steps
to be completed earlier and more deterministically, and the
race elimianted.

NOTE: the swap channel parameter to bridge_stasis_push (and
thus all bridge push callbacks) must always be present when
performing a swap with another channel.

ASTERISK-24649 #close
Reported by: John Bigelow
Review: https://reviewboard.asterisk.org/r/4341/

This patch is a remedial cherry-pick from v13.

Change-Id: I35c98989786f74cdd7940677002a1a88d34bd2dd
res/stasis/app.c
res/stasis/stasis_bridge.c