From 12f8f9e5ac624f120b21923c89b5aa144a70966a Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Wed, 22 Dec 2021 12:12:37 +0100 Subject: lib: Fix waiting for FRCT at deallocation This is a fix to wait for outstanding retransmissions when a flow is deallocated. Instead of waiting the full timeout, it will now wait in the same tic increments used within FRCT. Bit of a stopgap at the moment, FRCT and the flows are in need of a serious refactor. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/dev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/dev.c b/src/lib/dev.c index 86074e2b..c8b7d93b 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -800,14 +800,14 @@ int flow_dealloc(int fd) timeo = frcti_dealloc(f->frcti); while (timeo < 0) { /* keep the flow active for rtx */ - ssize_t ret; - uint8_t buf[128]; + ssize_t ret; + uint8_t buf[128]; + struct timespec tic = {0, TICTIME}; f->oflags = FLOWFDEFAULT | FLOWFRNOPART; f->rcv_timesout = true; - f->rcv_timeo.tv_sec = -timeo; - f->rcv_timeo.tv_nsec = 0; + f->rcv_timeo = tic; pthread_rwlock_unlock(&ai.lock); @@ -817,7 +817,7 @@ int flow_dealloc(int fd) timeo = frcti_dealloc(f->frcti); - if ((ret == -ETIMEDOUT || ret == -EFLOWDOWN) && timeo < 0) + if (ret == -EFLOWDOWN && timeo < 0) timeo = -timeo; } @@ -1432,7 +1432,7 @@ ssize_t fevent(struct flow_set * set, return -EINVAL; if (fq->fqsize > 0 && fq->next != fq->fqsize) - return fq->fqsize; + return 1; clock_gettime(PTHREAD_COND_CLOCK, &abs); -- cgit v1.2.3