summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2020-12-05 15:58:15 +0100
committerSander Vrijders <sander@ouroboros.rocks>2020-12-05 16:01:16 +0100
commit37ebb798813514bc29b60ea7d28b99ad1036c68d (patch)
tree4da77481a549866ecc11763ab6455a457a8f81cc /src/ipcpd
parent962b37bb28724bdf28abbe5d48350adba6000ed4 (diff)
downloadouroboros-37ebb798813514bc29b60ea7d28b99ad1036c68d.tar.gz
ouroboros-37ebb798813514bc29b60ea7d28b99ad1036c68d.zip
ipcpd: Fix off-by-one in Multi-bit (F)ECN policy
Noticed an off-by-one in the packet counter because it was incremented before and the byte counter after the flow update. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd')
-rw-r--r--src/ipcpd/unicast/pol/ca-mb-ecn.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/ipcpd/unicast/pol/ca-mb-ecn.c b/src/ipcpd/unicast/pol/ca-mb-ecn.c
index 0542e291..31a646b2 100644
--- a/src/ipcpd/unicast/pol/ca-mb-ecn.c
+++ b/src/ipcpd/unicast/pol/ca-mb-ecn.c
@@ -119,6 +119,7 @@ ca_wnd_t mb_ecn_ctx_update_snd(void * _ctx,
ctx->tx_ctr++;
ctx->tx_wpc++;
+ ctx->tx_wbc += len;
if (ctx->tx_ctr > CA_WND)
ctx->tx_ece = 0;
@@ -153,8 +154,6 @@ ca_wnd_t mb_ecn_ctx_update_snd(void * _ctx,
ctx->tx_wpc = 0;
}
- ctx->tx_wbc += len;
-
if (ctx->tx_wbc > ctx->tx_wbl)
wnd.wait = ((ctx->tx_slot + 1) << ctx->tx_mul) - ts_to_ns(now);
else