From: Alan T. DeKok Date: Tue, 21 Feb 2012 17:07:23 +0000 (+0100) Subject: Better fix for fixed point computations X-Git-Tag: release_3_0_0_beta0~300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5c6564419e4bce9ee79672a7573f1fe9dd0dbbc;p=thirdparty%2Ffreeradius-server.git Better fix for fixed point computations So if rate_pps < 1000, we can still count it. --- diff --git a/src/main/process.c b/src/main/process.c index b4d800b3d84..1eaecc2b68e 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -1334,9 +1334,9 @@ int request_receive(rad_listen_t *listener, RADIUS_PACKET *packet, pps = USEC - now.tv_usec; pps /= 1000; /* now 0..9999 */ pps *= sock->rate_pps_old; /* capped at 1000000 */ - pps /= 1000; - pps += sock->rate_pps_now; + pps += sock->rate_pps_now * 1000; + pps /= 1000; if (pps > sock->max_rate) { DEBUG("Dropping request due to rate limiting");