]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: check for send_proxy during the connect(), not the SI
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Oct 2013 19:45:00 +0000 (21:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2013 14:40:23 +0000 (15:40 +0100)
It's cleaner to check for a pending send_proxy_ofs while establishing
the connection (which already checks it anyway) and not in the stream
interface.

include/proto/stream_interface.h
src/proto_tcp.c

index 46d0c729c412a9220220c1a6aac1a7b1070e6e4f..1cf94217daf4f59b08aa8e9d71bf6762c657cb9c 100644 (file)
@@ -201,7 +201,7 @@ static inline int si_connect(struct stream_interface *si)
        if (unlikely(!conn || !conn->ctrl || !conn->ctrl->connect))
                return SN_ERR_INTERNAL;
 
-       ret = conn->ctrl->connect(conn, !channel_is_empty(si->ob), !!conn->send_proxy_ofs);
+       ret = conn->ctrl->connect(conn, !channel_is_empty(si->ob), 0);
        if (ret != SN_ERR_NONE)
                return ret;
 
@@ -209,10 +209,6 @@ static inline int si_connect(struct stream_interface *si)
        if (si->flags & SI_FL_SRC_ADDR)
                conn_get_from_addr(conn);
 
-       /* Prepare to send a few handshakes related to the on-wire protocol. */
-       if (conn->send_proxy_ofs)
-               conn->flags |= CO_FL_SI_SEND_PROXY;
-
        /* we need to be notified about connection establishment */
        conn->flags |= CO_FL_WAKE_DATA;
 
index 1c55b6a6f619167a361884df62f8cb52ffdb5bda..1f984453e2cffa9607715457c05add8f7d806696 100644 (file)
@@ -257,6 +257,8 @@ int tcp_bind_socket(int fd, int flags, struct sockaddr_storage *local, struct so
  *   - 1 = delayed ACK if backend has tcp-smart-connect, regardless of data
  *   - 2 = delayed ACK regardless of backend options
  *
+ * Note that a pending send_proxy message accounts for data.
+ *
  * It can return one of :
  *  - SN_ERR_NONE if everything's OK
  *  - SN_ERR_SRVTO if there are no more servers
@@ -415,6 +417,9 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
                }
        }
 
+       /* if a send_proxy is there, there are data */
+       data |= conn->send_proxy_ofs;
+
 #if defined(TCP_QUICKACK)
        /* disabling tcp quick ack now allows the first request to leave the
         * machine with the first ACK. We only do this if there are pending
@@ -465,6 +470,10 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
        conn->flags  = CO_FL_WAIT_L4_CONN; /* connection in progress */
        conn->flags |= CO_FL_ADDR_TO_SET;
 
+       /* Prepare to send a few handshakes related to the on-wire protocol. */
+       if (conn->send_proxy_ofs)
+               conn->flags |= CO_FL_SI_SEND_PROXY;
+
        conn_ctrl_init(conn);       /* registers the FD */
        conn_sock_want_send(conn);  /* for connect status */