]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: checks: fix recv polling after connect()
authorWilly Tarreau <w@1wt.eu>
Fri, 23 Nov 2012 15:32:33 +0000 (16:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 23 Nov 2012 15:32:33 +0000 (16:32 +0100)
Commit a522f801 moved a call to __conn_data_want_recv() just after the
connect() call, which is not 100% correct. First, it does not take errors
into account, eventhough this is harmless. Second, this change will only
be taken into account after next call do conn_data_polling_update(), which
is not necessarily what is expected (eg: if an error is only reported on
the recv side).

So let's use conn_data_poll_recv() instead, which directly subscribes
the event to polling.

src/checks.c

index b4a937ccbf8997bf93e64b6f5ac5398db1027973..530ccd8bcf6da506315dddf90f4c1546dac4101a 100644 (file)
@@ -1323,7 +1323,6 @@ static struct task *process_chk(struct task *t)
                 * connect() when a pure TCP check is used.
                 */
                ret = s->check.proto->connect(conn, (s->proxy->options2 & PR_O2_CHK_ANY) ? 1 : 2);
-               __conn_data_want_recv(conn);   /* prepare for reading a possible reply */
                conn->flags |= CO_FL_WAKE_DATA;
                if (s->check.send_proxy)
                        conn->flags |= CO_FL_LOCAL_SPROXY;
@@ -1340,6 +1339,7 @@ static struct task *process_chk(struct task *t)
                                int t_con = tick_add(now_ms, s->proxy->timeout.connect);
                                t->expire = tick_first(t->expire, t_con);
                        }
+                       conn_data_poll_recv(conn);   /* prepare for reading a possible reply */
                        goto reschedule;
 
                case SN_ERR_SRVTO: /* ETIMEDOUT */