MEDIUM: stream-int: make conn_si_send_proxy() use conn_sock_send()
This substantially simplifies the code as we don't need to handle the
file descriptors anymore nor the specific error codes from send().
diff --git a/src/stream_interface.c b/src/stream_interface.c
index d237a82..3fc1e56 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -413,9 +413,6 @@
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 @@
/* 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 @@
out_wait:
__conn_sock_stop_recv(conn);
- fd_cant_send(conn->t.sock.fd);
return 0;
}