diff options
author | Richard Mudgett <rmudgett@digium.com> | 2016-03-07 13:21:44 -0600 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-03-16 14:44:51 -0500 |
commit | 69810b306df0f311acf550653e5ba9e2c24e2963 (patch) | |
tree | 13be4f5b34e2e42944b1b662dc5a69c2274ba22e /channels/sip/include/dialog.h | |
parent | 67c79c326d3c0d1945a83622e490f226bc942a6d (diff) |
chan_sip.c: Fix autokillid deadlock potential.
This patch is part of a series to resolve deadlocks in chan_sip.c.
Stopping a scheduled event can result in a deadlock if the scheduled event
is running when you try to stop the event. If you hold a lock needed by
the scheduled event while trying to stop the scheduled event then a
deadlock can happen. The general strategy for resolving the deadlock
potential is to push the actual starting and stopping of the scheduled
events off onto the scheduler/do_monitor() thread by scheduling an
immediate one shot scheduled event. Some restructuring may be needed
because the code may assume that the start/stop of the scheduled events is
immediate.
* Fix clearing autokillid in __sip_autodestruct() even though we could
reschedule.
ASTERISK-25023
Change-Id: I450580dbf26e2e3952ee6628c735b001565c368f
Diffstat (limited to 'channels/sip/include/dialog.h')
-rw-r--r-- | channels/sip/include/dialog.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/channels/sip/include/dialog.h b/channels/sip/include/dialog.h index f6adea59b..069417097 100644 --- a/channels/sip/include/dialog.h +++ b/channels/sip/include/dialog.h @@ -39,9 +39,22 @@ struct sip_pvt *__sip_alloc(ast_string_field callid, struct ast_sockaddr *sin, #define sip_alloc(callid, addr, useglobal_nat, intended_method, req, logger_callid) \ __sip_alloc(callid, addr, useglobal_nat, intended_method, req, logger_callid, __FILE__, __LINE__, __PRETTY_FUNCTION__) +/*! + * \brief Schedule final destruction of SIP dialog. + * + * \note This cannot be canceled. + * + * \details + * This function is used to keep a dialog around for a period of time in order + * to properly respond to any retransmits. + */ void sip_scheddestroy_final(struct sip_pvt *p, int ms); + +/*! \brief Schedule destruction of SIP dialog */ void sip_scheddestroy(struct sip_pvt *p, int ms); -int sip_cancel_destroy(struct sip_pvt *p); + +/*! \brief Cancel destruction of SIP dialog. */ +void sip_cancel_destroy(struct sip_pvt *pvt); /*! * \brief Unlink a dialog from the dialogs container, as well as any other places |