struct connection *conn = check->conn;
struct protocol *proto;
int ret;
+ int quickack;
/* tcpcheck send/expect initialisation */
if (check->type == PR_O2_TCPCHK_CHK)
set_host_port(&conn->addr.to, check->port);
}
+ /* only plain tcp-check supports quick ACK */
+ quickack = check->type == 0 || check->type == PR_O2_TCPCHK_CHK;
+
if (check->type == PR_O2_TCPCHK_CHK && !LIST_ISEMPTY(&s->proxy->tcpcheck_rules)) {
struct tcpcheck_rule *r = (struct tcpcheck_rule *) s->proxy->tcpcheck_rules.n;
/* if first step is a 'connect', then tcpcheck_main must run it */
tcpcheck_main(conn);
return SN_ERR_UP;
}
+ if (r->action == TCPCHK_ACT_EXPECT)
+ quickack = 0;
}
ret = SN_ERR_INTERNAL;
if (proto->connect)
- ret = proto->connect(conn, check->type, (check->type) ? 0 : 2);
+ ret = proto->connect(conn, check->type, quickack ? 2 : 0);
conn->flags |= CO_FL_WAKE_DATA;
if (s->check.send_proxy) {
conn->send_proxy_ofs = 1;
static void tcpcheck_main(struct connection *conn)
{
char *contentptr;
- struct tcpcheck_rule *cur = NULL;
+ struct tcpcheck_rule *cur, *next;
int done = 0, ret = 0;
struct check *check = conn->owner;
struct server *s = check->server;
break;
}
+ /* have 'next' point to the next rule or NULL if we're on the last one */
+ next = (struct tcpcheck_rule *)cur->list.n;
+ if (&next->list == head)
+ next = NULL;
+
if (check->current_step->action == TCPCHK_ACT_CONNECT) {
struct protocol *proto;
struct xprt_ops *xprt;
ret = SN_ERR_INTERNAL;
if (proto->connect)
- ret = proto->connect(conn, 1, 0);
+ ret = proto->connect(conn,
+ 1 /* I/O polling is always needed */,
+ (next && next->action == TCPCHK_ACT_EXPECT) ? 0 : 2);
conn->flags |= CO_FL_WAKE_DATA;
if (check->current_step->conn_opts & TCPCHK_OPT_SEND_PROXY) {
conn->send_proxy_ofs = 1;