chan_sip: Reorder unload_module to deal with stuck TCP threads.
authorCorey Farrell <git@cfware.com>
Fri, 9 Dec 2016 02:00:02 +0000 (21:00 -0500)
committerCorey Farrell <git@cfware.com>
Sat, 17 Dec 2016 16:25:40 +0000 (11:25 -0500)
commit8fbb384ea2f0f5e648f8137c2b77104e910a34d9
tree960d063190d450f1c6dcf3d8e301519becbbb053
parent19328de2ab1317e75a7bf4cb6ebf9fce55cb05e1
chan_sip: Reorder unload_module to deal with stuck TCP threads.

In some situations TCP threads may become frozen.  This creates the
possibility that Asterisk could segfault if they become unfrozen after
chan_sip has been dlclose'd.  This reorders the unload_module process to
allow abort if threads do not exit within 5 seconds.

High level order as follows:
1) Unregister from the core to stop new requests.
2) Signal threads to stop
3) Clear config based tables (but do not free the table itself).
4) Verify that threads have shutdown, cancel unload if not.
5) Clean all remaining resources.

ASTERISK-26586

Change-Id: Ie23692041d838fbd35ece61868f4c640960ff882
channels/chan_sip.c