/*! * \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 Insert a ro_session timer to the list * \param tl ro_session timer list * \param interval timeout value in seconds * \return 0 on success, -1 when the input timer list is invalid */ int insert_ro_timer(struct ro_tl *tl, int interval) { lock_get(roi_timer->lock); LM_DBG("inserting timer for interval [%i]\n", interval); if (tl->next != 0 || tl->prev != 0) { lock_release(roi_timer->lock); LM_CRIT("Trying to insert a bogus ro tl=%p tl->next=%p tl->prev=%p\n", tl, tl->next, tl->prev); return -1; } tl->timeout = get_ticks() + interval; insert_ro_timer_unsafe(tl); LM_DBG("TIMER inserted"); lock_release(roi_timer->lock); return 0; }