diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2020-04-30 21:21:36 +0200 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2020-05-01 10:13:10 +0200 |
commit | 04b5a939c6a29cdbc733b1113ee8baf400b601bb (patch) | |
tree | aa752b9d9f75923dd59ea01430dd17d970fcd2e5 /src/lib/frct.c | |
parent | 978266fe4beba21292daad2d341fe5ff22e08aba (diff) | |
download | ouroboros-04b5a939c6a29cdbc733b1113ee8baf400b601bb.tar.gz ouroboros-04b5a939c6a29cdbc733b1113ee8baf400b601bb.zip |
lib: Fix updating retransmission wheel
Fixes infinite rescheduling with RTO getting lower than the timerwheel
resolution. For very low RTO values we'd need a big packet buffer with
the current memory allocator implementation (rdrbuff). Setting a
(configurable) minimum RTO (250 us) reduces this need.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/frct.c')
-rw-r--r-- | src/lib/frct.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/frct.c b/src/lib/frct.c index bc07be5a..0e9d64c7 100644 --- a/src/lib/frct.c +++ b/src/lib/frct.c @@ -25,7 +25,7 @@ #define DELT_A 3000 /* ms */ #define DELT_R 20000 /* ms */ -#define RQ_SIZE 64 +#define RQ_SIZE 1024 #define TW_ELEMENTS 6000 #define TW_RESOLUTION 1 /* ms */ @@ -119,9 +119,9 @@ static struct frcti * frcti_create(int fd) frcti->rttseq = 0; frcti->probe = false; - frcti->srtt_us = 0; /* updated on first ACK */ - frcti->mdev_us = 100000; /* initial rxm will be after 200 ms */ - frcti->rto = 200000; /* initial rxm will be after 200 ms */ + frcti->srtt_us = 0; /* updated on first ACK */ + frcti->mdev_us = 10000; /* initial rxm will be after 20 ms */ + frcti->rto = 20000; /* initial rxm will be after 20 ms */ if (ai.flows[fd].qs.loss == 0) { frcti->snd_cr.cflags |= FRCTFRTX; @@ -304,7 +304,7 @@ static void rtt_estimator(struct frcti * frcti, frcti->srtt_us = MAX(1U, srtt); frcti->mdev_us = MAX(1U, rttvar); - frcti->rto = srtt + (rttvar >> 2); + frcti->rto = MAX(RTO_MIN, srtt + (rttvar >> 2)); } /* Returns 0 when idx contains a packet for the application. */ @@ -391,6 +391,6 @@ static int __frcti_rcv(struct frcti * frcti, drop_packet: pthread_rwlock_unlock(&frcti->lock); shm_rdrbuff_remove(ai.rdrb, idx); - rxmwheel_move(); + return -EAGAIN; } |