res_pjsip: Correct usages of pjproject's timer heap

Fix some timer heap initializations and cancels to try and prevent
crashes and timer heap issues.

Change-Id: I64885d190fa22097d1b55987091375541e57a7ee
This commit is contained in:
George Joseph
2018-01-02 06:54:54 -07:00
parent 48720e7def
commit f91263cf46
4 changed files with 12 additions and 12 deletions

View File

@@ -362,7 +362,8 @@ static struct ast_sip_event_publisher_handler *find_publisher_handler_for_event_
/*! \brief Helper function which cancels the refresh timer on a publisher */
static void cancel_publish_refresh(struct sip_outbound_publisher *publisher)
{
if (pj_timer_heap_cancel(pjsip_endpt_get_timer_heap(ast_sip_get_pjsip_endpoint()), &publisher->timer)) {
if (pj_timer_heap_cancel_if_active(pjsip_endpt_get_timer_heap(ast_sip_get_pjsip_endpoint()),
&publisher->timer, 0)) {
/* The timer was successfully cancelled, drop the refcount of the publisher */
ao2_ref(publisher, -1);
}