Fix a race condition that caused device states to become incorrect for hints.
authorRussell Bryant <russell@russellbryant.com>
Tue, 17 Feb 2009 17:33:38 +0000 (17:33 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 17 Feb 2009 17:33:38 +0000 (17:33 +0000)
The problem here is that the hint processing code was subscribed to the wrong
event type.  So, it started processing state for a hint too soon, before the
device state cache had been updated.

Also, fix a similar bug in app_queue, as it was also subscribed to the wrong
event type.

(closes issue #14461)
Reported by: alecdavis

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176557 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c
main/pbx.c

index 15472cd..58b68cd 100644 (file)
@@ -7095,7 +7095,7 @@ static int load_module(void)
                ast_log(LOG_WARNING, "devicestate taskprocessor reference failed - devicestate notifications will not occur\n");
        }
 
-       if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE_CHANGE, device_state_cb, NULL, AST_EVENT_IE_END))) {
+       if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL, AST_EVENT_IE_END))) {
                res = -1;
        }
 
index 96e42db..4c2b273 100644 (file)
@@ -9102,7 +9102,7 @@ int load_pbx(void)
        /* Register manager application */
        ast_manager_register2("ShowDialPlan", EVENT_FLAG_CONFIG | EVENT_FLAG_REPORTING, manager_show_dialplan, "List dialplan", mandescr_show_dialplan);
 
-       if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE_CHANGE, device_state_cb, NULL,
+       if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL,
                        AST_EVENT_IE_END))) {
                return -1;
        }