summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2022-02-27 10:53:13 +0100
committerSander Vrijders <sander@ouroboros.rocks>2022-03-03 12:05:57 +0100
commita9509290da36d6222c89d7770290571c5f4092ca (patch)
treec52510275f4c97ffb90f5eadd9754885ea717f70 /src/lib
parent8969cd1f19409b110c761ed5dda1d6cb57399a64 (diff)
downloadouroboros-a9509290da36d6222c89d7770290571c5f4092ca.tar.gz
ouroboros-a9509290da36d6222c89d7770290571c5f4092ca.zip
lib: Fix underflow in keepalive timer
If the keepalive would underflow if set to 1-3 ms. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 31941afd..c5667f06 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -1084,7 +1084,7 @@ static int flow_keepalive(int fd)
return -EFLOWPEER;
}
- if (ts_diff_ns(&s_act, &now) > (timeo >> 2) * MILLION)
+ if (ts_diff_ns(&s_act, &now) > (timeo * MILLION) >> 2)
flow_send_keepalive(fd);
return 0;