res_pjsip_transport_management.c: Misc cleanups to survive shutdown.
authorRichard Mudgett <rmudgett@digium.com>
Wed, 18 May 2016 22:37:27 +0000 (17:37 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 15 Jun 2016 19:43:36 +0000 (14:43 -0500)
commit3c80f84cd03d3857e7c90b280c5101d60767b277
treef8cf7487cb926b0358d72affe7f468db0f0a3b3d
parent7c59f2126fe313e4e8ae351b2176ab33bc53fcf2
res_pjsip_transport_management.c: Misc cleanups to survive shutdown.

* In unload_module(), reordered destroying things to minimize the window
that the global transports container could be used by other threads on
shutdown.  When shutting down you need to stop things in the opposite
order of creation.

* Put the global transports container into an AO2_GLOBAL_OBJ_STATIC to
eliminate the crash potential by other threads using the container on
shutdown.

* Made struct monitored_transport.sip_received not use
ast_atomic_fetchadd_int() since it is used as a boolean value that is only
set TRUE.  It was previously incremented for every received SIP message
and could theoretically overflow.

* In monitored_transport_state_callback(), allocated the monitored
transport object without a lock since the lock was unused.

* In keepalive_global_loaded(), removed releasing the transports container
if the keepalive_thread could not be started.  I set it up to be tried
again if the user reloads the configuration.

Change-Id: I8d12d16ef564290fa6d25a32334bb5ce8fdf87ff
res/res_pjsip_transport_management.c