From: Willy Tarreau Date: Mon, 16 Dec 2013 17:04:57 +0000 (+0100) Subject: BUG/MINOR: stats: correctly report throttle rate of low weight servers X-Git-Tag: v1.5-dev21~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e38feed966070142e1fd5d3033c9e999a9ffe83c;p=thirdparty%2Fhaproxy.git BUG/MINOR: stats: correctly report throttle rate of low weight servers The throttling of low weight servers (<16) could mistakenly be reported as > 100% due to a rounding that was performed before a multiply by 100 instead of after. This was introduced in 1.5-dev20 when fixing a previous reporting issue by commit d32c399 (MINOR: stats: report correct throttling percentage for servers in slowstart). It should be backported if the patch above is backported. --- diff --git a/include/proto/server.h b/include/proto/server.h index 9cb8144701..93f4f81a66 100644 --- a/include/proto/server.h +++ b/include/proto/server.h @@ -75,7 +75,7 @@ static inline unsigned int server_throttle_rate(struct server *sv) if (!sv->uweight) return 100; - return 100U * (px->lbprm.wmult * sv->eweight + px->lbprm.wdiv - 1) / (px->lbprm.wdiv * sv->uweight); + return (100U * px->lbprm.wmult * sv->eweight + px->lbprm.wdiv - 1) / (px->lbprm.wdiv * sv->uweight); } /*