diff options
author | Dimitri Staessens <[email protected]> | 2022-03-10 08:23:15 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2022-03-11 17:51:27 +0100 |
commit | f300e609e7975dacc06996d407170fe58aa49439 (patch) | |
tree | b6210cb429de6ab1a3cd555562b8b4b15a7f82c0 /src/lib/frct.c | |
parent | a7032da6bbe875596ea1cb348a747123cda7d408 (diff) | |
download | ouroboros-f300e609e7975dacc06996d407170fe58aa49439.tar.gz ouroboros-f300e609e7975dacc06996d407170fe58aa49439.zip |
lib: Fix buffer allocation when retransmitting0.19.0
The timerwheel was retransmitting packets and the error check for
negative values of the rbuff allocation was instead checking for
non-zero values, causing a buffer allocation to succeed but the
program to continue down the unhappy path leaving that packet stuck in
the buffer unattended.
Also fixes wrongly scheduled retransmissions that cause packet storms.
FRCP is much more stable now. Still needs some work for high
bandwidth-delay products (fast-retransmit).
Signed-off-by: Dimitri Staessens <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/lib/frct.c')
-rw-r--r-- | src/lib/frct.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/frct.c b/src/lib/frct.c index e9ee7718..5540ad2e 100644 --- a/src/lib/frct.c +++ b/src/lib/frct.c @@ -53,6 +53,8 @@ struct frcti { struct timespec t_probe; /* Probe time */ bool probe; /* Probe active */ + size_t n_rtx; /* Number of rxm packets */ + struct frct_cr snd_cr; struct frct_cr rcv_cr; @@ -130,7 +132,8 @@ static int frct_rib_read(const char * path, "Receiver left window edge: %20u\n" "Receiver right window edge: %20u\n" "Receiver inactive (ns): %20ld\n" - "Receiver last ack: %20u\n", + "Receiver last ack: %20u\n" + "Number of pkt retransmissions: %20zu\n", frcti->mpl, frcti->a, frcti->r, @@ -144,7 +147,8 @@ static int frct_rib_read(const char * path, frcti->rcv_cr.lwe, frcti->rcv_cr.rwe, ts_diff_ns(&frcti->rcv_cr.act, &now), - frcti->rcv_cr.seqno); + frcti->rcv_cr.seqno, + frcti->n_rtx); pthread_rwlock_unlock(&flow->frcti->lock); @@ -310,6 +314,10 @@ static struct frcti * frcti_create(int fd, #ifdef PROC_FLOW_STATS char frctstr[FRCT_NAME_STRLEN + 1]; #endif + mpl *= BILLION; + a *= BILLION; + r *= BILLION; + frcti = malloc(sizeof(*frcti)); if (frcti == NULL) goto fail_malloc; @@ -354,7 +362,9 @@ static struct frcti * frcti_create(int fd, frcti->srtt = 0; /* Updated on first ACK */ frcti->mdev = 10 * MILLION; /* Initial rxm will be after 20 ms */ - frcti->rto = 20 * MILLION; /* Initial rxm will be after 20 ms */ + frcti->rto = BILLION; /* Initial rxm will be after 1 s */ + + frcti->n_rtx = 0; if (ai.flows[fd].qs.loss == 0) { frcti->snd_cr.cflags |= FRCTFRTX | FRCTFLINGER; @@ -739,7 +749,7 @@ static void rtt_estimator(struct frcti * frcti, frcti->srtt = MAX(1000U, srtt); frcti->mdev = MAX(100U, rttvar); - frcti->rto = MAX(RTO_MIN, frcti->srtt + (frcti->mdev << 1)); + frcti->rto = MAX(RTO_MIN, frcti->srtt + (frcti->mdev << 2)); } static void __frcti_tick(void) @@ -803,7 +813,7 @@ static void __frcti_rcv(struct frcti * frcti, if (after(ackno, frcti->snd_cr.lwe)) frcti->snd_cr.lwe = ackno; - if (frcti->probe && !before(frcti->rttseq, ackno)) { + if (frcti->probe && after(ackno, frcti->rttseq)) { rtt_estimator(frcti, ts_diff_ns(&frcti->t_probe, &now)); frcti->probe = false; } |