-tcp_ledbat_after_idle(struct tcpcb *tp) {
- int32_t n = N_RTT_BASE, i = (N_RTT_BASE - 1);
-
- /* Decide how many base history entries have to be cleared
- * based on how long the connection has been idle.
- */
-
- if (tp->t_rttcur > 0) {
- int32_t nrtt, idle_time;
-
- idle_time = tcp_now - tp->t_rcvtime;
- nrtt = idle_time / tp->t_rttcur;
- n = nrtt / rtt_samples_per_slot;
- if (n > N_RTT_BASE)
- n = N_RTT_BASE;
- }
- for (i = (N_RTT_BASE - 1); n > 0; --i, --n) {
- tp->rtt_hist[i] = 0;
- }
- for (n = (N_RTT_BASE - 1); i >= 0; --i, --n) {
- tp->rtt_hist[n] = tp->rtt_hist[i];
- tp->rtt_hist[i] = 0;
- }
-