MEDIUM: checks: make tcpcheck_main() indicate if it recycled a connection
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Oct 2017 16:41:00 +0000 (18:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Oct 2017 16:49:22 +0000 (18:49 +0200)
commit6bdcab014980a5f1793b3e27834f1bfcdab9c9f5
tree69d63c6d3755624a86ee017b974b2222bb07b22e
parentf411cce456dabbe3cf6637f2bb11435af0499ae7
MEDIUM: checks: make tcpcheck_main() indicate if it recycled a connection

The tcp-checks are very fragile. They can modify a connection's FD by
closing and reopening a socket without informing the connection layer,
which may then possibly touch the wrong fd. Given that the events are
only cleared and that the fd is just created, there should be no visible
side effect because the old fd is deleted so even if its flags get cleared
they were already, and the new fd already has them cleared as well so it's
a NOP. Regardless, this is too fragile and will not resist to threads.

In order to address this situation, this patch makes tcpcheck_main()
indicate if it closed a connection and report it to wake_srv_chk(), which
will then report it to the connection's fd handler so that it refrains
from updating the connection polling and the fd. Instead the connection
polling status is updated in the wake() function.
src/checks.c