MINOR: quic: Disable the action of ->rcv_buf() xprt callback

Deactivate the action of this callback at this time. I am not sure
we will keep it for QUIC as it does not really make sense for QUIC:
the QUIC packet are already recvfrom()'ed by the low level I/O handler
used for all the connections.
This commit is contained in:
Frédéric Lécaille 2021-03-03 16:23:44 +01:00 committed by Amaury Denoyelle
parent 27faba7240
commit fbe3b77c4e

View File

@ -4148,19 +4148,12 @@ struct task *quic_conn_io_cb(struct task *t, void *context, unsigned int state)
return t; return t;
} }
/* Receive up to <count> bytes from connection <conn>'s socket and store them /* Copy up to <count> bytes from connection <conn> internal stream storage into buffer <buf>.
* into buffer <buf>. Only one call to recv() is performed, unless the * Return the number of bytes which have been copied.
* buffer wraps, in which case a second call may be performed. The connection's
* flags are updated with whatever special event is detected (error, read0,
* empty). The caller is responsible for taking care of those events and
* avoiding the call if inappropriate. The function does not call the
* connection's polling update function, so the caller is responsible for this.
* errno is cleared before starting so that the caller knows that if it spots an
* error without errno, it's pending and can be retrieved via getsockopt(SO_ERROR).
*/ */
static size_t quic_conn_to_buf(struct connection *conn, void *xprt_ctx, struct buffer *buf, size_t count, int flags) static size_t quic_conn_to_buf(struct connection *conn, void *xprt_ctx,
struct buffer *buf, size_t count, int flags)
{ {
ssize_t ret;
size_t try, done = 0; size_t try, done = 0;
if (!conn_ctrl_ready(conn)) if (!conn_ctrl_ready(conn))
@ -4170,24 +4163,10 @@ static size_t quic_conn_to_buf(struct connection *conn, void *xprt_ctx, struct b
return 0; return 0;
conn->flags &= ~CO_FL_WAIT_ROOM; conn->flags &= ~CO_FL_WAIT_ROOM;
errno = 0;
if (unlikely(!(fdtab[conn->handle.fd].state & FD_POLL_IN))) {
/* stop here if we reached the end of data */
if ((fdtab[conn->handle.fd].state & (FD_POLL_ERR|FD_POLL_HUP)) == FD_POLL_HUP)
goto read0;
/* report error on POLL_ERR before connection establishment */
if ((fdtab[conn->handle.fd].state & FD_POLL_ERR) && (conn->flags & CO_FL_WAIT_L4_CONN)) {
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
goto leave;
}
}
/* read the largest possible block. For this, we perform only one call /* read the largest possible block. For this, we perform only one call
* to recv() unless the buffer wraps and we exactly fill the first hunk, * to recv() unless the buffer wraps and we exactly fill the first hunk,
* in which case we accept to do it once again. A new attempt is made on * in which case we accept to do it once again.
* EINTR too.
*/ */
while (count > 0) { while (count > 0) {
try = b_contig_space(buf); try = b_contig_space(buf);
@ -4197,42 +4176,9 @@ static size_t quic_conn_to_buf(struct connection *conn, void *xprt_ctx, struct b
if (try > count) if (try > count)
try = count; try = count;
ret = recvfrom(conn->handle.fd, b_tail(buf), try, 0, NULL, 0); b_add(buf, try);
done += try;
if (ret > 0) { count -= try;
b_add(buf, ret);
done += ret;
if (ret < try) {
/* unfortunately, on level-triggered events, POLL_HUP
* is generally delivered AFTER the system buffer is
* empty, unless the poller supports POLL_RDHUP. If
* we know this is the case, we don't try to read more
* as we know there's no more available. Similarly, if
* there's no problem with lingering we don't even try
* to read an unlikely close from the client since we'll
* close first anyway.
*/
if (fdtab[conn->handle.fd].state & FD_POLL_HUP)
goto read0;
if (!(fdtab[conn->handle.fd].state & FD_LINGER_RISK) ||
(cur_poller.flags & HAP_POLL_F_RDHUP)) {
break;
}
}
count -= ret;
}
else if (ret == 0) {
goto read0;
}
else if (errno == EAGAIN || errno == ENOTCONN) {
fd_cant_recv(conn->handle.fd);
break;
}
else if (errno != EINTR) {
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
break;
}
} }
if (unlikely(conn->flags & CO_FL_WAIT_L4_CONN) && done) if (unlikely(conn->flags & CO_FL_WAIT_L4_CONN) && done)