]> 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:44:54 +0000 (17:44 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 30 Jan 2015 17:44:54 +0000 (17:44 +0000)
commit05e2832b35b53c36531d35fd2c36b654d8f4d697
tree5fa8ea5e402524d4af9f484f4c55b55741789952
parent6583b4de98dfa8ba1964dc4e685b02d260a749ed
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/

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