[asterisk-commits] mmichelson: branch mmichelson/queue_bugbug r394464 - /team/mmichelson/queue_b...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 16 12:55:16 CDT 2013
Author: mmichelson
Date: Tue Jul 16 12:55:14 2013
New Revision: 394464
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394464
Log:
Add a bit of semblance of synchronicity for dying gracefully.
Modified:
team/mmichelson/queue_bugbug/apps/app_queue.c
Modified: team/mmichelson/queue_bugbug/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/queue_bugbug/apps/app_queue.c?view=diff&rev=394464&r1=394463&r2=394464
==============================================================================
--- team/mmichelson/queue_bugbug/apps/app_queue.c (original)
+++ team/mmichelson/queue_bugbug/apps/app_queue.c Tue Jul 16 12:55:14 2013
@@ -5161,7 +5161,7 @@
time_t starttime;
int caller_pos;
int callcompletedinsl;
- int hangup_detected;
+ int dying;
struct stasis_subscription *bridge_sub;
struct stasis_subscription *caller_sub;
struct stasis_subscription *local_caller_sub;
@@ -5178,6 +5178,7 @@
static void remove_stasis_subscriptions(struct queue_stasis_data *queue_data)
{
+ queue_data->dying = 1;
queue_data->bridge_sub = stasis_unsubscribe(queue_data->bridge_sub);
queue_data->caller_sub = stasis_unsubscribe(queue_data->caller_sub);
queue_data->local_caller_sub = stasis_unsubscribe(queue_data->local_caller_sub);
@@ -5214,7 +5215,13 @@
if (stasis_subscription_final_message(sub, msg)) {
ao2_cleanup(queue_data);
- } else if (ast_channel_entered_bridge_type() == stasis_message_type(msg)) {
+ }
+
+ if (queue_data->dying) {
+ return;
+ }
+
+ if (ast_channel_entered_bridge_type() == stasis_message_type(msg)) {
struct ast_bridge_blob *enter_blob = stasis_message_data(msg);
if (!ast_strlen_zero(queue_data->bridge_uniqueid)) {
@@ -5276,20 +5283,17 @@
if (stasis_subscription_final_message(sub, msg)) {
ao2_cleanup(queue_data);
- } else if (ast_channel_hangup_request_type() == stasis_message_type(msg)) {
+ }
+
+ if (queue_data->dying) {
+ return;
+ }
+
+ if (ast_channel_hangup_request_type() == stasis_message_type(msg)) {
struct ast_channel_blob *channel_blob = stasis_message_data(msg);
RAII_VAR(struct ast_channel_snapshot *, caller, NULL, ao2_cleanup);
RAII_VAR(struct ast_channel_snapshot *, agent, NULL, ao2_cleanup);
enum agent_complete_reason reason;
-
- ao2_lock(queue_data);
- if (queue_data->hangup_detected) {
- ao2_unlock(queue_data);
- stasis_unsubscribe(sub);
- return;
- }
- queue_data->hangup_detected = 1;
- ao2_unlock(queue_data);
if (!strcmp(channel_blob->snapshot->uniqueid, queue_data->caller_uniqueid)) {
reason = CALLER;
More information about the asterisk-commits
mailing list