summaryrefslogtreecommitdiff
path: root/src/lib/frct.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2022-04-01 21:10:57 +0200
committerSander Vrijders <sander@ouroboros.rocks>2022-04-03 18:01:01 +0200
commit1312034c37c6f389f65bfb2f6cee05260d751848 (patch)
tree7eb9f6c17f0362c1e8b241a94ddba37d6f8547d6 /src/lib/frct.c
parent6180aa78409627325cbba1a2e751260410cac54f (diff)
downloadouroboros-1312034c37c6f389f65bfb2f6cee05260d751848.tar.gz
ouroboros-1312034c37c6f389f65bfb2f6cee05260d751848.zip
lib: Fix delayed ACK under high load
The delayed ACK was wrongly measuring the delay against the receiver activity instead of the sender activity. Also fixed receiver activity not being updated for non-data packets (and duplicates and other dropped traffic). 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.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/frct.c b/src/lib/frct.c
index 4effad3b..d6db6fea 100644
--- a/src/lib/frct.c
+++ b/src/lib/frct.c
@@ -302,7 +302,13 @@ static void send_frct_pkt(struct frcti * frcti)
rwe = frcti->rcv_cr.rwe;
diff = ts_diff_ns(&frcti->rcv_cr.act, &now);
- if (diff > frcti->a || diff < TICTIME) {
+ if (diff > frcti->a) {
+ pthread_rwlock_unlock(&frcti->lock);
+ return;
+ }
+
+ diff = ts_diff_ns(&frcti->snd_cr.act, &now);
+ if (diff < TICTIME) {
pthread_rwlock_unlock(&frcti->lock);
return;
}
@@ -828,6 +834,8 @@ static void __frcti_rcv(struct frcti * frcti,
}
}
+ rcv_cr->act = now;
+
/* For now, just send an immediate window update. */
if (pci->flags & FRCT_RDVS) {
fd = frcti->fd;
@@ -914,8 +922,6 @@ static void __frcti_rcv(struct frcti * frcti,
frcti->rq[pos] = idx;
- rcv_cr->act = now;
-
pthread_rwlock_unlock(&frcti->lock);
if (fd != -1)