summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2016-01-05 19:08:24 -0600
committerRichard Mudgett <rmudgett@digium.com>2016-06-14 16:46:49 -0500
commit7c59f2126fe313e4e8ae351b2176ab33bc53fcf2 (patch)
tree801a2ae6d3d5061799f46c773c946d86a9f2ee22 /res
parent181766748fb5c4ef3024cdb0e7fa330669e50e7c (diff)
res_pjsip.c: Add check that timer actually got scheduled.
Change-Id: Iabaa2e5dccf0762c258101ea0eb1487cf6959ad1
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 8fc3c530e..9944702c3 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3406,7 +3406,7 @@ static pj_status_t endpt_send_request(struct ast_sip_endpoint *endpoint,
ast_debug(2, "%p: Set timer to %d msec\n", req_wrapper, timeout);
pj_timer_entry_init(req_wrapper->timeout_timer, TIMEOUT_TIMER2,
- req_wrapper, &send_request_timer_callback);
+ req_wrapper, send_request_timer_callback);
pj_timer_heap_cancel_if_active(pjsip_endpt_get_timer_heap(endpt),
req_wrapper->timeout_timer, TIMER_INACTIVE);
@@ -3415,8 +3415,18 @@ static pj_status_t endpt_send_request(struct ast_sip_endpoint *endpoint,
* timer callback is executed.
*/
ao2_ref(req_wrapper, +1);
- pj_timer_heap_schedule(pjsip_endpt_get_timer_heap(endpt),
+ ret_val = pj_timer_heap_schedule(pjsip_endpt_get_timer_heap(endpt),
req_wrapper->timeout_timer, &timeout_timer_val);
+ if (ret_val != PJ_SUCCESS) {
+ ao2_unlock(req_wrapper);
+ ast_log(LOG_ERROR,
+ "Failed to set timer. Not sending %.*s request to endpoint %s.\n",
+ (int) pj_strlen(&tdata->msg->line.req.method.name),
+ pj_strbuf(&tdata->msg->line.req.method.name),
+ endpoint ? ast_sorcery_object_get_id(endpoint) : "<unknown>");
+ ao2_t_ref(req_wrapper, -2, "Drop timer and routine ref");
+ return ret_val;
+ }
req_wrapper->timeout_timer->id = TIMEOUT_TIMER2;
} else {