diff options
author | Matt Jordan <mjordan@digium.com> | 2015-06-19 10:11:36 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-06-19 10:11:36 -0500 |
commit | bd77ace25aace29c5936458b702146fc1b0288a1 (patch) | |
tree | 42a64471706519abdcec5e0d579f2604e66d4206 | |
parent | 9668a1acb56f07c3d69296268986eae90767b1ad (diff) | |
parent | d7a1e84a1ee62743f9473ecbd7de31ea7afa8def (diff) |
Merge "Resolve race conditions involving Stasis bridges."
-rw-r--r-- | res/res_stasis.c | 6 | ||||
-rw-r--r-- | res/stasis/control.c | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/res/res_stasis.c b/res/res_stasis.c index 631af1e2e..f7d8299f4 100644 --- a/res/res_stasis.c +++ b/res/res_stasis.c @@ -1280,6 +1280,7 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc, /* Check to see if a bridge absorbed our hangup frame */ if (ast_check_hangup_locked(chan)) { + control_mark_done(control); break; } @@ -1303,6 +1304,7 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc, if (r < 0) { ast_debug(3, "%s: Poll error\n", ast_channel_uniqueid(chan)); + control_mark_done(control); break; } @@ -1323,6 +1325,7 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc, /* Continue on in the dialplan */ ast_debug(3, "%s: Hangup (no more frames)\n", ast_channel_uniqueid(chan)); + control_mark_done(control); break; } @@ -1331,13 +1334,14 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc, /* Continue on in the dialplan */ ast_debug(3, "%s: Hangup\n", ast_channel_uniqueid(chan)); + control_mark_done(control); break; } } } ast_channel_lock(chan); - needs_depart = ast_channel_is_bridged(chan); + needs_depart = (ast_channel_internal_bridge_channel(chan) != NULL); ast_channel_unlock(chan); if (needs_depart) { ast_bridge_depart(chan); diff --git a/res/stasis/control.c b/res/stasis/control.c index a61e96137..99407dfab 100644 --- a/res/stasis/control.c +++ b/res/stasis/control.c @@ -745,7 +745,7 @@ static int app_send_command_on_condition(struct stasis_app_control *control, { RAII_VAR(struct stasis_app_command *, command, NULL, ao2_cleanup); - if (control == NULL) { + if (control == NULL || control->is_done) { return -1; } @@ -770,7 +770,7 @@ int stasis_app_send_command_async(struct stasis_app_control *control, { RAII_VAR(struct stasis_app_command *, command, NULL, ao2_cleanup); - if (control == NULL) { + if (control == NULL || control->is_done) { return -1; } |