/*! * \brief Update a ro_session timer on the list * \param tl dialog timer * \param timeout new timeout value in seconds * \return 0 on success, -1 when the input list is invalid * \note the update is implemented as a remove, insert */ int update_ro_timer(struct ro_tl *tl, int timeout) { lock_get(roi_timer->lock); if (tl->next) { if (tl->prev == 0) { lock_release(roi_timer->lock); return -1; } remove_ro_timer_unsafe(tl); } tl->timeout = get_ticks() + timeout; insert_ro_timer_unsafe(tl); lock_release(roi_timer->lock); return 0; }
/*! * \brief Update a ro_session timer on the list * \param tl dialog timer * \param timeout new timeout value in seconds * \return 0 on success, -1 when the input list is invalid * \note the update is implemented as a remove, insert */ int update_ro_timer(struct ro_tl *tl, int timeout) { lock_get(roi_timer->lock); LM_DBG("Updating ro timer [%p] with timeout [%d]\n", tl, timeout); if (tl->next) { if (tl->prev == 0) { lock_release(roi_timer->lock); return -1; } remove_ro_timer_unsafe(tl); } tl->timeout = get_ticks() + timeout; insert_ro_timer_unsafe(tl); lock_release(roi_timer->lock); return 0; }
/*! * \brief Remove a ro_session timer from the list * \param tl ro_session timer that should be removed * \return 1 when the input timer is empty, 0 when the timer was removed, * -1 when the input timer list is invalid */ int remove_ro_timer(struct ro_tl *tl) { lock_get(roi_timer->lock); if (tl->prev == NULL && tl->timeout == 0) { lock_release(roi_timer->lock); return 1; } if (tl->prev == NULL || tl->next == NULL) { LM_CRIT("bogus tl=%p tl->prev=%p tl->next=%p\n", tl, tl->prev, tl->next); lock_release(roi_timer->lock); return -1; } LM_DBG("TIMER [%p] REMOVED\n", tl); remove_ro_timer_unsafe(tl); tl->next = NULL; tl->prev = NULL; tl->timeout = 0; lock_release(roi_timer->lock); return 0; }