[Asterisk-code-review] res pjsip session.c: Extract sip session defer termination s... (asterisk[13])

Matt Jordan asteriskteam at digium.com
Thu Jul 16 20:33:38 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: res_pjsip_session.c: Extract sip_session_defer_termination_stop_timer().
......................................................................


res_pjsip_session.c: Extract sip_session_defer_termination_stop_timer().

Change-Id: I9e115dee74bd72e06081d0ee73ecdeb886caa5fb
---
M res/res_pjsip_session.c
1 file changed, 19 insertions(+), 7 deletions(-)

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



diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index f2f2fc9..6389ff8 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1693,6 +1693,23 @@
 	return res;
 }
 
+/*!
+ * \internal
+ * \brief Stop the defer termination timer if it is still running.
+ * \since 13.5.0
+ *
+ * \param session Which session to stop the timer.
+ *
+ * \return Nothing
+ */
+static void sip_session_defer_termination_stop_timer(struct ast_sip_session *session)
+{
+	if (pj_timer_heap_cancel(pjsip_endpt_get_timer_heap(ast_sip_get_pjsip_endpoint()),
+		&session->scheduled_termination)) {
+		ao2_ref(session, -1);
+	}
+}
+
 void ast_sip_session_defer_termination_cancel(struct ast_sip_session *session)
 {
 	if (!session->defer_terminate) {
@@ -1707,10 +1724,7 @@
 	}
 
 	/* Stop the termination timer if it is still running. */
-	if (pj_timer_heap_cancel(pjsip_endpt_get_timer_heap(ast_sip_get_pjsip_endpoint()),
-		&session->scheduled_termination)) {
-		ao2_ref(session, -1);
-	}
+	sip_session_defer_termination_stop_timer(session);
 }
 
 struct ast_sip_session *ast_sip_dialog_get_session(pjsip_dialog *dlg)
@@ -2257,9 +2271,7 @@
 	struct ast_sip_session_supplement *iter;
 
 	/* Stop the scheduled termination */
-	if (pj_timer_heap_cancel(pjsip_endpt_get_timer_heap(ast_sip_get_pjsip_endpoint()), &session->scheduled_termination)) {
-		ao2_ref(session, -1);
-	}
+	sip_session_defer_termination_stop_timer(session);
 
 	/* Session is dead.  Notify the supplements. */
 	AST_LIST_TRAVERSE(&session->supplements, iter, next) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9e115dee74bd72e06081d0ee73ecdeb886caa5fb
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list