summaryrefslogtreecommitdiff
path: root/misc.h
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2018-12-07 04:36:09 +0000
committerDamien Miller <djm@mindrot.org>2018-12-27 14:30:17 +1100
commit434b587afe41c19391821e7392005068fda76248 (patch)
tree2aee75c1f39344d80af0772aa4dacf6885e827f5 /misc.h
parenta6a0788cbbe8dfce2819ee43b09c80725742e21c (diff)
upstream: Fix calculation of initial bandwidth limits. Account for
written bytes before the initial timer check so that the first buffer written is accounted. Set the threshold after which the timer is checked such that the limit starts being computed as soon as possible, ie after the second buffer is written. This prevents an initial burst of traffic and provides a more accurate bandwidth limit. bz#2927, ok djm. OpenBSD-Commit-ID: ff3ef76e4e43040ec198c2718d5682c36b255cb6
Diffstat (limited to 'misc.h')
-rw-r--r--misc.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/misc.h b/misc.h
index bcae6a50..2dd61dc3 100644
--- a/misc.h
+++ b/misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.h,v 1.76 2018/11/16 03:26:01 djm Exp $ */
+/* $OpenBSD: misc.h,v 1.77 2018/12/07 04:36:09 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -135,7 +135,9 @@ void put_u32_le(void *, u_int32_t)
struct bwlimit {
size_t buflen;
- u_int64_t rate, thresh, lamt;
+ u_int64_t rate; /* desired rate in kbit/s */
+ u_int64_t thresh; /* threshold after which we'll check timers */
+ u_int64_t lamt; /* amount written in last timer interval */
struct timeval bwstart, bwend;
};