i came to the same conclusion,
ok benno@
Reyk Floeter([email protected]) on 2017.02.09 00:25:31 +0100:
> On Tue, Feb 07, 2017 at 05:04:18PM -0500, Michael W. Lucas wrote:
> > host 104.236.197.233, check send expect (9020ms,tcp read timeout), state
> > unknown -> down, availability 0.00%
>
> The send/expect code looses its error because of its async nature -
> it goes like:
>
> 1. "we got data, let's verify it"
> 2. "expect test failed, but maybe we didn't read enough, let's try again"
> 3. "no more data, timeout"
>
> When we reach 3), the code also has to check if there is anything in
> the input buffer from 1) and verify it again. The following code
> fixes it to show "send/expect failed" instead of "tcp read timeout".
>
> Reyk
>
> Index: usr.sbin/relayd/check_tcp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/relayd/check_tcp.c,v
> retrieving revision 1.51
> diff -u -p -u -p -r1.51 check_tcp.c
> --- usr.sbin/relayd/check_tcp.c 11 Jan 2016 21:31:42 -0000 1.51
> +++ usr.sbin/relayd/check_tcp.c 8 Feb 2017 23:16:14 -0000
> @@ -233,8 +233,12 @@ tcp_read_buf(int s, short event, void *a
> struct ctl_tcp_event *cte = arg;
>
> if (event == EV_TIMEOUT) {
> - tcp_close(cte, HOST_DOWN);
> - hce_notify_done(cte->host, HCE_TCP_READ_TIMEOUT);
> + if (ibuf_size(cte->buf))
> + (void)cte->validate_close(cte);
> + else
> + cte->host->he = HCE_TCP_READ_TIMEOUT;
> + tcp_close(cte, cte->host->up == HOST_UP ? 0 : HOST_DOWN);
> + hce_notify_done(cte->host, cte->host->he);
> return;
> }