mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 06:41:32 +02:00
MINOR: mux-pt: Report end-of-input with the end-of-stream after a read
In the PT multiplexer, the end of stream is also the end of input. Thus we must report EOI to the stream-endpoint descriptor when the EOS is reported. For now, it is a bit useless but it will be important to disginguish an shutdown to an error to an abort. To be sure to not report an EOI on an error, the errors are now handled first.
This commit is contained in:
parent
84d3ef982c
commit
872b01c984
22
src/mux_pt.c
22
src/mux_pt.c
@ -527,16 +527,18 @@ static size_t mux_pt_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count
|
||||
}
|
||||
b_realign_if_empty(buf);
|
||||
ret = conn->xprt->rcv_buf(conn, conn->xprt_ctx, buf, count, flags);
|
||||
if (conn_xprt_read0_pending(conn)) {
|
||||
se_fl_clr(ctx->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
|
||||
se_fl_set(ctx->sd, SE_FL_EOS);
|
||||
TRACE_DEVEL("read0 on connection", PT_EV_RX_DATA, conn, sc);
|
||||
}
|
||||
if (conn->flags & CO_FL_ERROR) {
|
||||
se_fl_clr(ctx->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
|
||||
if (conn_xprt_read0_pending(conn))
|
||||
se_fl_set(ctx->sd, SE_FL_EOS);
|
||||
se_fl_set(ctx->sd, SE_FL_ERROR);
|
||||
TRACE_DEVEL("error on connection", PT_EV_RX_DATA|PT_EV_CONN_ERR, conn, sc);
|
||||
}
|
||||
else if (conn_xprt_read0_pending(conn)) {
|
||||
se_fl_clr(ctx->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
|
||||
se_fl_set(ctx->sd, (SE_FL_EOI|SE_FL_EOS));
|
||||
TRACE_DEVEL("read0 on connection", PT_EV_RX_DATA, conn, sc);
|
||||
}
|
||||
end:
|
||||
TRACE_LEAVE(PT_EV_RX_DATA, conn, sc, buf, (size_t[]){ret});
|
||||
return ret;
|
||||
@ -603,14 +605,16 @@ static int mux_pt_rcv_pipe(struct stconn *sc, struct pipe *pipe, unsigned int co
|
||||
TRACE_ENTER(PT_EV_RX_DATA, conn, sc, 0, (size_t[]){count});
|
||||
|
||||
ret = conn->xprt->rcv_pipe(conn, conn->xprt_ctx, pipe, count);
|
||||
if (conn_xprt_read0_pending(conn)) {
|
||||
se_fl_set(ctx->sd, SE_FL_EOS);
|
||||
TRACE_DEVEL("read0 on connection", PT_EV_RX_DATA, conn, sc);
|
||||
}
|
||||
if (conn->flags & CO_FL_ERROR) {
|
||||
if (conn_xprt_read0_pending(conn))
|
||||
se_fl_set(ctx->sd, SE_FL_EOS);
|
||||
se_fl_set(ctx->sd, SE_FL_ERROR);
|
||||
TRACE_DEVEL("error on connection", PT_EV_RX_DATA|PT_EV_CONN_ERR, conn, sc);
|
||||
}
|
||||
else if (conn_xprt_read0_pending(conn)) {
|
||||
se_fl_set(ctx->sd, (SE_FL_EOS|SE_FL_EOI));
|
||||
TRACE_DEVEL("read0 on connection", PT_EV_RX_DATA, conn, sc);
|
||||
}
|
||||
|
||||
TRACE_LEAVE(PT_EV_RX_DATA, conn, sc, 0, (size_t[]){ret});
|
||||
return (ret);
|
||||
|
Loading…
x
Reference in New Issue
Block a user