summaryrefslogtreecommitdiff
path: root/res/res_pjsip_outbound_registration.c
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2018-01-02 06:54:54 -0700
committerGeorge Joseph <gjoseph@digium.com>2018-04-02 10:17:27 -0500
commitf91263cf4648b9174f845f2742fdb2f98b5c613d (patch)
tree3d5243733cd77324d3e836e182eec28e77291000 /res/res_pjsip_outbound_registration.c
parent48720e7def5af54aa1f07352cd292f11dfdb7ae6 (diff)
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
Diffstat (limited to 'res/res_pjsip_outbound_registration.c')
-rw-r--r--res/res_pjsip_outbound_registration.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index d0f754604..2839ecbab 100644
--- a/res/res_pjsip_outbound_registration.c
+++ b/res/res_pjsip_outbound_registration.c
@@ -512,7 +512,8 @@ static struct ast_sip_endpoint_identifier line_identifier = {
/*! \brief Helper function which cancels the timer on a client */
static void cancel_registration(struct sip_outbound_registration_client_state *client_state)
{
- if (pj_timer_heap_cancel(pjsip_endpt_get_timer_heap(ast_sip_get_pjsip_endpoint()), &client_state->timer)) {
+ if (pj_timer_heap_cancel_if_active(pjsip_endpt_get_timer_heap(ast_sip_get_pjsip_endpoint()),
+ &client_state->timer, client_state->timer.id)) {
/* The timer was successfully cancelled, drop the refcount of client_state */
ao2_ref(client_state, -1);
}
@@ -1129,8 +1130,8 @@ static struct sip_outbound_registration_state *sip_outbound_registration_state_a
}
state->client_state->status = SIP_REGISTRATION_UNREGISTERED;
- state->client_state->timer.user_data = state->client_state;
- state->client_state->timer.cb = sip_outbound_registration_timer_cb;
+ pj_timer_entry_init(&state->client_state->timer, 0, state->client_state,
+ sip_outbound_registration_timer_cb);
state->client_state->transport_name = ast_strdup(registration->transport);
state->client_state->registration_name =
ast_strdup(ast_sorcery_object_get_id(registration));