summaryrefslogtreecommitdiff
path: root/src/lib/frct.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2021-12-20 16:55:07 +0100
committerSander Vrijders <sander@ouroboros.rocks>2021-12-22 16:34:27 +0100
commite95fcce0c4e3901347c51016f01128a3c87f75b8 (patch)
tree99a387047d26039128adc8d382c059caf392655c /src/lib/frct.c
parentb9df537e7180b416659998f9a728abc289706423 (diff)
downloadouroboros-e95fcce0c4e3901347c51016f01128a3c87f75b8.tar.gz
ouroboros-e95fcce0c4e3901347c51016f01128a3c87f75b8.zip
lib: Fix flow dealloc after expired FRCT timeout
If the timeout is already expired, the wait variable would be negative and return a negative value for the __frcti_dealloc function, thinking that the timeout was not expired causing an unnecessary wait even if all packets are acknowledged. 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.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lib/frct.c b/src/lib/frct.c
index af21ed4d..61a3fde0 100644
--- a/src/lib/frct.c
+++ b/src/lib/frct.c
@@ -631,6 +631,7 @@ static time_t __frcti_dealloc(struct frcti * frcti)
wait = MAX(frcti->rcv_cr.inact - now.tv_sec + frcti->rcv_cr.act.tv_sec,
frcti->snd_cr.inact - now.tv_sec + frcti->snd_cr.act.tv_sec);
+ wait = MAX(wait, 0);
if (frcti->snd_cr.cflags & FRCTFLINGER
&& before(frcti->snd_cr.lwe, frcti->snd_cr.seqno))