~ubuntu-branches/ubuntu/precise/haproxy/precise-updates

« back to all changes in this revision

Viewing changes to debian/patches/srv_dynamic_maxconn.patch

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Cornet
  • Date: 2009-02-17 08:55:12 UTC
  • mfrom: (1.1.5 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090217085512-qmij51nun3rbxorz
Tags: 1.3.15.7-2
Fix build without debian/patches directory (Closes: #515682) using
/usr/share/quilt/quilt.make.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
commit 819970098f134453c0934047b3bd3440b0996b55
2
 
Author: Willy Tarreau <w@1wt.eu>
3
 
Date:   Sun Sep 14 17:43:27 2008 +0200
4
 
 
5
 
    [BUG] dynamic connection throttling could return a max of zero conns
6
 
    
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.
10
 
    
11
 
    Apply the MAX(1, max) before returning the result in order to ensure
12
 
    that a newly appeared server will get some traffic.
13
 
 
14
 
diff --git a/src/queue.c b/src/queue.c
15
 
index 178f187..905994a 100644
16
 
--- a/src/queue.c
17
 
+++ b/src/queue.c
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) {
21
 
                unsigned int ratio;
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);
26
 
        }
27
 
        return max;
28
 
 }