[asterisk-commits] res pjsip.c: Add check that timer actually got scheduled. (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 15 14:19:13 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: res_pjsip.c: Add check that timer actually got scheduled.
......................................................................


res_pjsip.c: Add check that timer actually got scheduled.

Change-Id: Iabaa2e5dccf0762c258101ea0eb1487cf6959ad1
---
M res/res_pjsip.c
1 file changed, 12 insertions(+), 2 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index adc4d41..bbaf778 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3410,7 +3410,7 @@
 		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);
@@ -3419,8 +3419,18 @@
 		 * 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 {

-- 
To view, visit https://gerrit.asterisk.org/3027
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iabaa2e5dccf0762c258101ea0eb1487cf6959ad1
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list