summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2021-12-22 12:12:37 +0100
committerSander Vrijders <sander@ouroboros.rocks>2021-12-22 16:35:55 +0100
commit12f8f9e5ac624f120b21923c89b5aa144a70966a (patch)
treeb40e637889fa1389344138513665593df67b1182
parentb1f19a134d44b3abc0dcb83982e7e0769cf3c105 (diff)
downloadouroboros-12f8f9e5ac624f120b21923c89b5aa144a70966a.tar.gz
ouroboros-12f8f9e5ac624f120b21923c89b5aa144a70966a.zip
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 <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--src/lib/dev.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 86074e2..c8b7d93 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);