]> git.ipfire.org Git - thirdparty/asterisk.git/commit
app_agent_pool: Fix initial module load agent device state reporting.
authorRichard Mudgett <rmudgett@digium.com>
Fri, 30 Jan 2015 17:53:54 +0000 (17:53 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 30 Jan 2015 17:53:54 +0000 (17:53 +0000)
commitb732e8cad9285b80c741538d0ec304f8b5650424
treeaa2f295db08856b220899638c15beed3f4b07ca7
parent968f8d51b47973d8e1499b9f379b5e2b8ca1c126
app_agent_pool: Fix initial module load agent device state reporting.

When the app_agent_pool module initially loads there is a race condition
between the thread loading agents.conf and the device state internal
processing thread.  If the device state internal processing thread handles
the agent creation state updates before the thread that loaded agents.conf
registers the device state provider callback then the cached agent state
is "Invalid".  When a consumer module like app_queue asks for the agent state
it gets the cached "Invalid" state instead of the real state from the provider.

* Moved loading the agents.conf configuration to the last thing setup by
app_agent_pool in load_module().  Now the device state provider callback
is registered before the config is loaded so the agent creation state
updates are guaranteed to get the initial device state.

* Removed some now redundant config cleanup on error in load_config().

* Added lock protection when accessing the device state in
agent_pvt_devstate_get() and eliminated the RAII_VAR() usage.

ASTERISK-24737 #close
Reported by: Steve Pitts

Review: https://reviewboard.asterisk.org/r/4390/
........

Merged revisions 431492 from http://svn.asterisk.org/svn/asterisk/branches/13

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/13.1@431494 65c4cc65-6c06-0410-ace0-fbb531ad65f3
apps/app_agent_pool.c