diff options
author | Richard Mudgett <rmudgett@digium.com> | 2015-07-10 18:01:43 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-07-15 10:55:52 -0500 |
commit | 2735dd5b2dd7cbc9ef2a8cf2573f53338f36fb62 (patch) | |
tree | 4a2ba4c55284403e6b3f9ca01e2b86ac1b547f8d /res | |
parent | 3d0ca343ca4c3f81e8739bc5a7aaed12b89a207e (diff) |
res_pjsip_session.c: Extract sip_session_defer_termination_stop_timer().
Change-Id: I9e115dee74bd72e06081d0ee73ecdeb886caa5fb
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip_session.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index f2f2fc968..6389ff848 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -1693,6 +1693,23 @@ int ast_sip_session_defer_termination(struct ast_sip_session *session) 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 @@ void ast_sip_session_defer_termination_cancel(struct ast_sip_session *session) } /* 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 @@ static void session_end(struct ast_sip_session *session) 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) { |