mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
MEDIUM: connection: don't use real send() flags in snd_buf()
This prevents us from passing other useful info and requires the upper levels to know these flags. Let's use a new flags category instead : CO_SFL_*. For now, only MSG_MORE has been remapped.
This commit is contained in:
parent
3be293f4a3
commit
1049b1f551
@ -177,6 +177,10 @@ enum {
|
||||
CO_SRC_BIND = 0x0008, /* bind to a specific source address when connecting */
|
||||
};
|
||||
|
||||
/* flags that can be passed to xprt->snd_buf() */
|
||||
enum {
|
||||
CO_SFL_MSG_MORE = 0x0001, /* More data to come afterwards */
|
||||
};
|
||||
|
||||
/* xprt_ops describes transport-layer operations for a connection. They
|
||||
* generally run over a socket-based control layer, but not always. Some
|
||||
|
@ -971,7 +971,7 @@ static void event_srv_chk_w(struct connection *conn)
|
||||
}
|
||||
|
||||
if (check->bo->o) {
|
||||
conn->xprt->snd_buf(conn, check->bo, MSG_DONTWAIT | MSG_NOSIGNAL);
|
||||
conn->xprt->snd_buf(conn, check->bo, 0);
|
||||
if (conn->flags & CO_FL_ERROR) {
|
||||
chk_report_conn_err(conn, errno, 0);
|
||||
__conn_data_stop_both(conn);
|
||||
@ -2037,7 +2037,7 @@ static void tcpcheck_main(struct connection *conn)
|
||||
check->current_step->action != TCPCHK_ACT_SEND ||
|
||||
check->current_step->string_len >= buffer_total_space(check->bo))) {
|
||||
|
||||
if (conn->xprt->snd_buf(conn, check->bo, MSG_DONTWAIT | MSG_NOSIGNAL) <= 0) {
|
||||
if (conn->xprt->snd_buf(conn, check->bo, 0) <= 0) {
|
||||
if (conn->flags & CO_FL_ERROR) {
|
||||
chk_report_conn_err(conn, errno, 0);
|
||||
__conn_data_stop_both(conn);
|
||||
|
@ -341,8 +341,8 @@ static int raw_sock_to_buf(struct connection *conn, struct buffer *buf, int coun
|
||||
|
||||
|
||||
/* Send all pending bytes from buffer <buf> to connection <conn>'s socket.
|
||||
* <flags> may contain MSG_MORE to make the system hold on without sending
|
||||
* data too fast.
|
||||
* <flags> may contain some CO_SFL_* flags to hint the system about other
|
||||
* pending data for example.
|
||||
* Only one call to send() is performed, unless the buffer wraps, in which case
|
||||
* a second call may be performed. The connection's flags are updated with
|
||||
* whatever special event is detected (error, empty). The caller is responsible
|
||||
@ -372,10 +372,10 @@ static int raw_sock_from_buf(struct connection *conn, struct buffer *buf, int fl
|
||||
try = buf->data + try - buf->p;
|
||||
|
||||
send_flag = MSG_DONTWAIT | MSG_NOSIGNAL;
|
||||
if (try < buf->o)
|
||||
if (try < buf->o || flags & CO_SFL_MSG_MORE)
|
||||
send_flag |= MSG_MORE;
|
||||
|
||||
ret = send(conn->t.sock.fd, bo_ptr(buf), try, send_flag | flags);
|
||||
ret = send(conn->t.sock.fd, bo_ptr(buf), try, send_flag);
|
||||
|
||||
if (ret > 0) {
|
||||
buf->o -= ret;
|
||||
|
@ -1499,8 +1499,8 @@ static int ssl_sock_to_buf(struct connection *conn, struct buffer *buf, int coun
|
||||
|
||||
|
||||
/* Send all pending bytes from buffer <buf> to connection <conn>'s socket.
|
||||
* <flags> may contain MSG_MORE to make the system hold on without sending
|
||||
* data too fast, but this flag is ignored at the moment.
|
||||
* <flags> may contain some CO_SFL_* flags to hint the system about other
|
||||
* pending data for example, but this flag is ignored at the moment.
|
||||
* Only one call to send() is performed, unless the buffer wraps, in which case
|
||||
* a second call may be performed. The connection's flags are updated with
|
||||
* whatever special event is detected (error, empty). The caller is responsible
|
||||
|
@ -693,13 +693,13 @@ static void si_conn_send(struct connection *conn)
|
||||
* The test is arranged so that the most common case does only 2
|
||||
* tests.
|
||||
*/
|
||||
unsigned int send_flag = MSG_DONTWAIT | MSG_NOSIGNAL;
|
||||
unsigned int send_flag = 0;
|
||||
|
||||
if ((!(chn->flags & (CF_NEVER_WAIT|CF_SEND_DONTWAIT)) &&
|
||||
((chn->to_forward && chn->to_forward != CHN_INFINITE_FORWARD) ||
|
||||
(chn->flags & CF_EXPECT_MORE))) ||
|
||||
((chn->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW))
|
||||
send_flag |= MSG_MORE;
|
||||
send_flag |= CO_SFL_MSG_MORE;
|
||||
|
||||
ret = conn->xprt->snd_buf(conn, chn->buf, send_flag);
|
||||
if (ret > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user