]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: checks: start sending the request right after connect()
authorWilly Tarreau <w@1wt.eu>
Thu, 5 Sep 2019 15:51:30 +0000 (17:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 6 Sep 2019 06:13:15 +0000 (08:13 +0200)
Since the change of I/O direction, we must not wait for an empty connect
callback before sending the request, we must attempt to send it as soon
as possible so that we don't uselessly poll. This is what this patch
does. This reduces the total check duration by a complete poll loop
compared to what is described in issue #253.

This must be backported to 2.0.

src/checks.c

index 4a60c414d0f64a144c98f5974b967c384b3b5435..55e8a17a09b02655e0f1614c07a5337f7235fd33 100644 (file)
@@ -2248,8 +2248,14 @@ static struct task *process_chk_conn(struct task *t, void *context, unsigned sho
                                t->expire = tick_first(t->expire, t_con);
                        }
 
-                       if (check->type)
+                       if (check->type) {
+                               /* send the request if we have one. We avoid receiving
+                                * if not connected, unless we didn't subscribe for
+                                * sending since otherwise we won't be woken up.
+                                */
+                               __event_srv_chk_w(cs);
                                __event_srv_chk_r(cs);
+                       }
 
                        task_set_affinity(t, tid_bit);
                        goto reschedule;