Skip to content

Commit

Permalink
Improve heartbeat timer calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
tuexen committed May 10, 2024
1 parent 4308e5e commit e711f82
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions usrsctplib/netinet/sctputil.c
Original file line number Diff line number Diff line change
Expand Up @@ -2393,19 +2393,19 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
} else {
to_ticks = net->RTO;
}
rndval = sctp_select_initial_TSN(&inp->sctp_ep);
jitter = rndval % to_ticks;
if (to_ticks > 1) {
to_ticks >>= 1;
}
if (jitter < (UINT32_MAX - to_ticks)) {
to_ticks += jitter;
} else {
to_ticks = UINT32_MAX;
}
if (!((net->dest_state & SCTP_ADDR_UNCONFIRMED) &&
(net->dest_state & SCTP_ADDR_REACHABLE)) &&
((net->dest_state & SCTP_ADDR_PF) == 0)) {
if (to_ticks > 1) {
rndval = sctp_select_initial_TSN(&inp->sctp_ep);
jitter = rndval % to_ticks;
to_ticks >>= 1;
if (jitter < (UINT32_MAX - to_ticks)) {
to_ticks += jitter;
} else {
to_ticks = UINT32_MAX;
}
}
if (net->heart_beat_delay < (UINT32_MAX - to_ticks)) {
to_ticks += net->heart_beat_delay;
} else {
Expand Down

0 comments on commit e711f82

Please sign in to comment.