a4eb897ddd31a8cf5535d4d9e253417019697750
[openwrt-packages.git] /
1 commit 7a74ffef9f356304b46ab862858cead85d451b5f
2 Author: Christopher Faulet <cfaulet@haproxy.com>
3 Date:   Mon Jan 21 14:15:50 2019 +0100
4
5     BUG/MINOR: check: Wake the check task if the check is finished in wake_srv_chk()
6     
7     With tcp-check, the result of the check is set by the function tcpcheck_main()
8     from the I/O layer. So it is important to wake up the check task to handle the
9     result and finish the check. Otherwise, we will wait the task timeout to handle
10     the result of a tcp-check, delaying the next check by as much.
11     
12     This patch also fixes a problem about email alerts reported by PiBa-NL (Pieter)
13     on the ML [1] on all versions since the 1.6. So this patch must be backported
14     from 1.9 to 1.6.
15     
16     [1] https://www.mail-archive.com/haproxy@formilux.org/msg32190.html
17     
18     (cherry picked from commit 774c486cece942570b6a9d16afe236a16ee12079)
19     Signed-off-by: Willy Tarreau <w@1wt.eu>
20     (cherry picked from commit 3722dfbbfadf8f83f82feb3e67fbe482a5c94840)
21     Signed-off-by: William Lallemand <wlallemand@haproxy.org>
22
23 diff --git a/src/checks.c b/src/checks.c
24 index 74958b2d..e04f1146 100644
25 --- a/src/checks.c
26 +++ b/src/checks.c
27 @@ -1403,12 +1403,13 @@ static int wake_srv_chk(struct conn_stream *cs)
28         }
29  
30         if (check->result != CHK_RES_UNKNOWN) {
31 -               /* We're here because nobody wants to handle the error, so we
32 -                * sure want to abort the hard way.
33 -                */
34 +               /* Check complete or aborted. If connection not yet closed do it
35 +                * now and wake the check task up to be sure the result is
36 +                * handled ASAP. */
37                 conn_sock_drain(conn);
38                 cs_close(cs);
39                 ret = -1;
40 +               task_wakeup(check->task, TASK_WOKEN_IO);
41         }
42  
43         HA_SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
git clone https://git.99rst.org/PROJECT