aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-01-09 17:20:28 -0800
committerFlorin Coras <florin.coras@gmail.com>2022-01-10 03:07:44 +0000
commit93dd58c8fb020870c770c2a4aa55dcc288fa2035 (patch)
tree49c23f22013b61a7d4e0c6f1f032b2377dcc7441 /src
parent26ea3ede43b9eb157a97850c70be3016040bd025 (diff)
session: fix pacer bucket update cast
Make sure comparison is done between two i64 values. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ief5706f2bd9415587994a5b665d5e380b8e14f68
Diffstat (limited to 'src')
-rw-r--r--src/vnet/session/transport.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index 4b263cd29b9..e4d84a3e209 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -660,12 +660,12 @@ static inline u32
spacer_max_burst (spacer_t * pacer, clib_us_time_t time_now)
{
u64 n_periods = (time_now - pacer->last_update);
- u64 inc;
+ i64 inc;
if ((inc = (f32) n_periods * pacer->tokens_per_period) > 10)
{
pacer->last_update = time_now;
- pacer->bucket = clib_min (pacer->bucket + inc, pacer->max_burst);
+ pacer->bucket = clib_min (pacer->bucket + inc, (i64) pacer->max_burst);
}
return pacer->bucket > 0 ? pacer->max_burst : 0;