On Tue, Feb 28, 2017 at 01:17:55PM +0100, Alberto Garcia wrote: > On Tue 28 Feb 2017 12:19:35 PM CET, Stefan Hajnoczi wrote: > > +/* undo internal bucket parameter changes (see throttle_fix_bucket()) */ > > +static void throttle_unfix_bucket(LeakyBucket *bkt) > > +{ > > + double min = bkt->avg / 10; > > + > > + if (bkt->max == min) { > > + bkt->max = 0; > > + } > > +} > > I guess you could do the more general if (bkt->max < bkt->avg), but your > solution is also fine with me. > > Reviewed-by: Alberto Garcia <be...@igalia.com>
I did that originally because I try to avoid floating-point equality. The test case uses an invalid setting though (->max = 1, ->avg = 56) which would be rejected if given on the command-line. Thinking about this again, it's probably better to modify the test case and use max < avg. Will send a v3. Stefan
signature.asc
Description: PGP signature