res_pjsip_config_wizard: Cleanup load unload
authorGeorge Joseph <george.joseph@fairview5.com>
Fri, 10 Apr 2015 17:00:38 +0000 (17:00 +0000)
committerGeorge Joseph <george.joseph@fairview5.com>
Fri, 10 Apr 2015 17:00:38 +0000 (17:00 +0000)
commitf69e46de25d016dd1c173d9077a4b2eb3505b704
tree387a97b2097ab24ad16c782e57f65360a061ba16
parent6f1a7fe05ffc2a049e0f311933d37a1c70d1323d
res_pjsip_config_wizard: Cleanup load unload

While investigating other unload issues I realized that the load/unload process
for the config wizard was pretty ugly so I've refactored it as follows...

When the res_pjsip sorcery instance is created the config_wizard bumps it's own
module reference to prevent it from unloading while the sorcery instance is
still active.  When res_pjsip unloads and it's sorcery instance is destroyed,
the config wizard unrefs itself which then allows itself to unload cleanly.
Since the config wizard now can't load after res_pjsip or unload before it
(which should have been the correct behavior all along), I was able to remove
the chunks of code in both load_module and unload_module that handled that case.

Ran the testsuite tests to insure there were no functional changes and REF_DEBUG
to insure that Asterisk was shutting down cleanly with no FRACKs or leaks.

Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4610/
........

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

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