Skip to content

Commit

Permalink
tm: enhance fr/retr timers logging
Browse files Browse the repository at this point in the history
- Mention when FR timeout is reached, and which of FR timers expired
- Log when starting FR/RETR timers
- log when changing default timeouts to user set values
- log when resetting fr/retr timers on provisional replies
  • Loading branch information
mrudenko authored and miconda committed Aug 11, 2021
1 parent dd63233 commit 05577d1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modules/tm/t_lookup.c
Expand Up @@ -1818,6 +1818,9 @@ int t_set_fr(struct sip_msg* msg, unsigned int fr_inv_to, unsigned int fr_to)
set_msgid_val(user_fr_inv_timeout, msg->id, int, (int)fr_inv);
set_msgid_val(user_fr_timeout, msg->id, int, (int)fr);
}else{
#ifdef TIMER_DEBUG
LM_DBG("changing default FR timeout values: (\"fr_inv_timeout\": %d, \"fr_timeout\": %d)\n", fr_inv, fr);
#endif
change_fr(t, fr_inv, fr); /* change running uac timers */
}
return 1;
Expand Down Expand Up @@ -1880,6 +1883,9 @@ int t_set_retr(struct sip_msg* msg, unsigned int t1_ms, unsigned int t2_ms)
set_msgid_val(user_rt_t1_timeout_ms, msg->id, int, (int)t1_ms);
set_msgid_val(user_rt_t2_timeout_ms, msg->id, int, (int)t2_ms);
}else{
#ifdef TIMER_DEBUG
LM_DBG("changing default RETR timeout values to: (\"retr_t1_interval\": %d, \"retr_t2_interval\": %d)\n", t1_ms, t2_ms);
#endif
change_retr(t, 1, t1_ms, t2_ms); /* change running uac timers */
}
return 1;
Expand Down
3 changes: 3 additions & 0 deletions src/modules/tm/t_reply.c
Expand Up @@ -2718,6 +2718,9 @@ int reply_received( struct sip_msg *p_msg )
( (last_uac_status<msg_status) &&
((msg_status>=180) || (last_uac_status==0)) )
) ) { /* provisional now */
#ifdef TIMER_DEBUG
LM_DBG("updating FR/RETR timers, \"fr_inv_timeout\": %d\n", t->fr_inv_timeout);
#endif
restart_rb_fr(& uac->request, t->fr_inv_timeout);
uac->request.flags|=F_RB_FR_INV; /* mark fr_inv */
} /* provisional replies */
Expand Down
3 changes: 3 additions & 0 deletions src/modules/tm/t_suspend.c
Expand Up @@ -486,6 +486,9 @@ int t_continue_helper(unsigned int hash_index, unsigned int label,
( (last_uac_status<msg_status) &&
((msg_status>=180) || (last_uac_status==0)) )
) ) { /* provisional now */
#ifdef TIMER_DEBUG
LM_DBG("updating FR/RETR timers, \"fr_inv_timeout\": %d\n", t->fr_inv_timeout);
#endif
restart_rb_fr(& t->uac[branch].request, t->fr_inv_timeout);
t->uac[branch].request.flags|=F_RB_FR_INV; /* mark fr_inv */
}
Expand Down
7 changes: 7 additions & 0 deletions src/modules/tm/timer.c
Expand Up @@ -510,6 +510,13 @@ ticks_t retr_buf_handler(ticks_t ticks, struct timer_ln *tl, void *p)
a little race risk, but
nothing bad would happen */
rbuf->flags |= F_RB_TIMEOUT;
#ifdef TIMER_DEBUG
if (rbuf->flags & F_RB_FR_INV) {
LM_DBG("reached the \"fr_inv_timeout\"\n");
} else {
LM_DBG("reached the \"fr_timeout\"\n");
}
#endif
/* WARNING: the next line depends on taking care not to start the
* wait timer before finishing with t (if this is not
* guaranteed then comment the timer_allow_del() line) */
Expand Down
4 changes: 4 additions & 0 deletions src/modules/tm/timer.h
Expand Up @@ -168,6 +168,10 @@ inline static int _set_fr_retr(struct retr_buf *rb, unsigned retr_ms)
ticks_t retr_ticks;
int ret;

#ifdef TIMER_DEBUG
LM_DBG("starting FR/RETR timers\n");
#endif

ticks = get_ticks_raw();
timeout = rb->my_T->fr_timeout;
eol = rb->my_T->end_of_life;
Expand Down

0 comments on commit 05577d1

Please sign in to comment.