summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2016-04-19 16:58:32 -0500
committerRichard Mudgett <rmudgett@digium.com>2016-04-20 15:45:38 -0500
commit9942d50aa5cca7f864344069e924d9b254380638 (patch)
treeb59808d871f537fdf34501f9a3e0222f199db14d /include
parentb1b34607830a55bedbc37c303ee1488a2c62c948 (diff)
bridge: Hold off more than one imparting channel at a time.
An earlier patch blocked the ast_bridge_impart() call until the channel either entered the target bridge or it failed. Unfortuantely, if the target bridge is stasis and the imprted channel is not a stasis channel, stasis bounces the channel out of the bridge to come back into the bridge as a proper stasis channel. When the channel is bounced out, that released the block on ast_bridge_impart() to continue. If the impart was a result of a transfer, then it became a race to see if the swap channel would get hung up before the imparted channel could come back into the stasis bridge. If the imparted channel won then everything is fine. If the swap channel gets hung up first then the transfer will fail because the swap channel is leaving the bridge. * Allow a chain of ast_bridge_impart()'s to happen before any are unblocked to prevent the race condition described above. When the channel finally joins the bridge or completely fails to join the bridge then the ast_bridge_impart() instances are unblocked. ASTERISK-25947 Reported by: Richard Mudgett ASTERISK-24649 Reported by: John Bigelow ASTERISK-24782 Reported by: John Bigelow Change-Id: I8fef369171f295f580024ab4971e95c799d0dde1
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/bridge_channel_internal.h38
1 files changed, 5 insertions, 33 deletions
diff --git a/include/asterisk/bridge_channel_internal.h b/include/asterisk/bridge_channel_internal.h
index 7f7d5a88b..fb8e781e8 100644
--- a/include/asterisk/bridge_channel_internal.h
+++ b/include/asterisk/bridge_channel_internal.h
@@ -151,47 +151,20 @@ int bridge_channel_internal_push_full(struct ast_bridge_channel *bridge_channel,
void bridge_channel_internal_pull(struct ast_bridge_channel *bridge_channel);
/*!
- * \brief Internal bridge channel wait condition and associated result.
- */
-struct bridge_channel_internal_cond {
- /*! Lock for the data structure */
- ast_mutex_t lock;
- /*! Wait condition */
- ast_cond_t cond;
- /*! Wait until done */
- int done;
- /*! The bridge channel */
- struct ast_bridge_channel *bridge_channel;
-};
-
-/*!
- * \internal
- * \brief Wait for the expected signal.
- * \since 13.5.0
- *
- * \param cond the wait object
- *
- * \return Nothing
- */
-void bridge_channel_internal_wait(struct bridge_channel_internal_cond *cond);
-
-/*!
- * \internal
- * \brief Signal the condition wait.
- * \since 13.5.0
+ * \brief Signal imparting threads to wake up.
+ * \since 13.9.0
*
- * \param cond the wait object
+ * \param chan Channel imparted that we need to signal.
*
* \return Nothing
*/
-void bridge_channel_internal_signal(struct bridge_channel_internal_cond *cond);
+void bridge_channel_impart_signal(struct ast_channel *chan);
/*!
* \internal
* \brief Join the bridge_channel to the bridge (blocking)
*
* \param bridge_channel The Channel in the bridge
- * \param cond data used for signaling
*
* \note The bridge_channel->swap holds a channel reference for the swap
* channel going into the bridging system. The ref ensures that the swap
@@ -206,8 +179,7 @@ void bridge_channel_internal_signal(struct bridge_channel_internal_cond *cond);
* \retval 0 bridge channel successfully joined the bridge
* \retval -1 bridge channel failed to join the bridge
*/
-int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel,
- struct bridge_channel_internal_cond *cond);
+int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel);
/*!
* \internal