]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: checks: do not uselessly poll for reads before the connection is up
authorWilly Tarreau <w@1wt.eu>
Thu, 5 Sep 2019 15:38:40 +0000 (17:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 6 Sep 2019 06:13:15 +0000 (08:13 +0200)
commitc5940392255e5a5a7eb0d27be62e155f1aec26c6
tree6faaa149fc9052eee457c5b5acf9ab83768bafaa
parent4c1a2b30a3c32df9e8fc7e8002d3390460816861
BUG/MINOR: checks: do not uselessly poll for reads before the connection is up

It's pointless to start to perform a recv() call on a connection that is
not yet established. The only purpose used to be to subscribe but that
causes many extra syscalls when we know we can do it later.

This patch only attempts a read if the connection is established or if
there is no write planed, since we want to be certain to be called. And
in wake_srv_chk() we continue to attempt to read if the reader was not
subscribed, so as to perform the first read attempt. In case a first
result is provided, __event_srv_chk_r() will not do anything anyway so
this is totally harmless in this case.

This fix requires that commit "BUG/MINOR: checks: make __event_chk_srv_r()
report success before closing" is applied before, otherwise it will break
some checks (notably SSL) by doing them again after the connection is shut
down. This completes the fixes on the checks described in issue #253 by
roughly cutting the number of syscalls in half. It must be backported to
2.0.
src/checks.c