]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stream-int: make conn_si_send_proxy() use conn_sock_send()
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Mar 2015 23:05:28 +0000 (00:05 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 12 Mar 2015 23:09:30 +0000 (00:09 +0100)
This substantially simplifies the code as we don't need to handle the
file descriptors anymore nor the specific error codes from send().

src/stream_interface.c

index d237a826dbeed9c3e5fcab098ffe7984bcab5695..3fc1e569355f94e344cf8b8dbab511a78a1dad56 100644 (file)
@@ -413,9 +413,6 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
        if (!conn_ctrl_ready(conn))
                goto out_error;
 
-       if (!fd_send_ready(conn->t.sock.fd))
-               goto out_wait;
-
        /* If we have a PROXY line to send, we'll use this to validate the
         * connection, in which case the connection is validated only once
         * we've sent the whole proxy line. Otherwise we use connect().
@@ -461,20 +458,11 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
                /* we have to send trash from (ret+sp for -sp bytes). If the
                 * data layer has a pending write, we'll also set MSG_MORE.
                 */
-               ret = send(conn->t.sock.fd, trash.str + ret + conn->send_proxy_ofs, -conn->send_proxy_ofs,
-                          (conn->flags & CO_FL_DATA_WR_ENA) ? MSG_MORE : 0);
-
-               if (ret == 0)
-                       goto out_wait;
+               ret = conn_sock_send(conn, trash.str + ret + conn->send_proxy_ofs, -conn->send_proxy_ofs,
+                                    (conn->flags & CO_FL_DATA_WR_ENA) ? MSG_MORE : 0);
 
-               if (ret < 0) {
-                       if (errno == EAGAIN || errno == ENOTCONN)
-                               goto out_wait;
-                       if (errno == EINTR)
-                               continue;
-                       conn->flags |= CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
+               if (ret < 0)
                        goto out_error;
-               }
 
                conn->send_proxy_ofs += ret; /* becomes zero once complete */
                if (conn->send_proxy_ofs != 0)
@@ -499,7 +487,6 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
 
  out_wait:
        __conn_sock_stop_recv(conn);
-       fd_cant_send(conn->t.sock.fd);
        return 0;
 }