summaryrefslogtreecommitdiff
path: root/main/rtp_engine.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2017-02-08 14:27:18 -0600
committerRichard Mudgett <rmudgett@digium.com>2017-02-10 12:05:56 -0600
commit16fdb11bc3bb23a2fd645a24a7ba56d9708960ff (patch)
treef103d60ec16e977d3fe9d92762ac37894a3b593e /main/rtp_engine.c
parent46147a8f3013ba7fcf326e1b2d6e1b6c4ad68202 (diff)
core: Cleanup some channel snapshot staging anomalies.
We shouldn't unlock the channel after starting a snapshot staging because another thread may interfere and do its own snapshot staging. * app_dial.c:dial_exec_full() made hold the channel lock while setting up the outgoing channel staging. Made hold the channel lock after the called party answers while updating the caller channel staging. * chan_sip.c:sip_new() completed the channel staging on off-nominal exit. Also we need to use ast_hangup() instead of ast_channel_unref() at that location. * channel.c:__ast_channel_alloc_ap() added a comment about not needing to complete the channel snapshot staging on off-nominal exit paths. * rtp_engine.c:ast_rtp_instance_set_stats_vars() made hold the channel locks while staging the channels for the stats channel variables. Change-Id: Iefb6336893163f6447bad65568722ad5d5d8212a
Diffstat (limited to 'main/rtp_engine.c')
-rw-r--r--main/rtp_engine.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 3ef2d876b..a46546318 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -1899,16 +1899,16 @@ void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_in
{
char quality_buf[AST_MAX_USER_FIELD];
char *quality;
- struct ast_channel *bridge = ast_channel_bridge_peer(chan);
+ struct ast_channel *bridge;
- ast_channel_lock(chan);
- ast_channel_stage_snapshot(chan);
- ast_channel_unlock(chan);
+ bridge = ast_channel_bridge_peer(chan);
if (bridge) {
- ast_channel_lock(bridge);
+ ast_channel_lock_both(chan, bridge);
ast_channel_stage_snapshot(bridge);
- ast_channel_unlock(bridge);
+ } else {
+ ast_channel_lock(chan);
}
+ ast_channel_stage_snapshot(chan);
quality = ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY,
quality_buf, sizeof(quality_buf));
@@ -1946,11 +1946,9 @@ void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_in
}
}
- ast_channel_lock(chan);
ast_channel_stage_snapshot_done(chan);
ast_channel_unlock(chan);
if (bridge) {
- ast_channel_lock(bridge);
ast_channel_stage_snapshot_done(bridge);
ast_channel_unlock(bridge);
ast_channel_unref(bridge);