1
commit 819970098f134453c0934047b3bd3440b0996b55
2
Author: Willy Tarreau <w@1wt.eu>
3
Date: Sun Sep 14 17:43:27 2008 +0200
5
[BUG] dynamic connection throttling could return a max of zero conns
7
srv_dynamic_maxconn() is clearly documented as returning at least 1
8
possible connection under throttling. But the computation was wrong,
9
the minimum 1 was divided and got lost in case of very low maxconns.
11
Apply the MAX(1, max) before returning the result in order to ensure
12
that a newly appeared server will get some traffic.
14
diff --git a/src/queue.c b/src/queue.c
15
index 178f187..905994a 100644
18
@@ -55,8 +55,8 @@ unsigned int srv_dynamic_maxconn(const struct server *s)
19
now.tv_sec < s->last_change + s->slowstart &&
20
now.tv_sec >= s->last_change) {
22
- ratio = MAX(1, 100 * (now.tv_sec - s->last_change) / s->slowstart);
23
- max = max * ratio / 100;
24
+ ratio = 100 * (now.tv_sec - s->last_change) / s->slowstart;
25
+ max = MAX(1, max * ratio / 100);