[Asterisk-code-review] res pjsip.c: Add check that timer actually got scheduled. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Tue Jun 14 16:46:55 CDT 2016


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/3028

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/28/3028/1

diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 8fc3c53..9944702 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3406,7 +3406,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);
@@ -3415,8 +3415,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/3028
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iabaa2e5dccf0762c258101ea0eb1487cf6959ad1
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list