From: Christopher Faulet Date: Tue, 7 Nov 2023 09:56:57 +0000 (+0100) Subject: MINOR: stconn/mux-h2: Use a iobuf flag to report EOI to consumer side during FF X-Git-Tag: v2.9-dev10~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84d26bcf3fd74e153dea98ad7d612373ea5c30ae;p=thirdparty%2Fhaproxy.git MINOR: stconn/mux-h2: Use a iobuf flag to report EOI to consumer side during FF IOBUF_FL_EOI iobuf flag is now set by the producer to notify the consumer that the end of input was reached. Thanks to this flag, we can remove the ugly ack in h2_done_ff() to test the opposite SE flags. Of course, for now, it works and it is good enough. But we must keep in mind that EOI is always forwarded from the producer side to the consumer side in this case. But if this change, a new CO_RFL_ flag will have to be added to instruct the producer if it can forward EOI or not. --- diff --git a/include/haproxy/stconn-t.h b/include/haproxy/stconn-t.h index ce06a5cce0..30f468ad7f 100644 --- a/include/haproxy/stconn-t.h +++ b/include/haproxy/stconn-t.h @@ -37,6 +37,7 @@ enum iobuf_flags { IOBUF_FL_INTERIM_FF = 0x00000008, /* Producer side warn it will immediately retry a fast-forward. * .done_fastfwd() on consumer side must take care of this flag */ + IOBUF_FL_EOI = 0x00000010, /* A EOI was encountered on producer side */ }; struct iobuf { diff --git a/src/mux_h1.c b/src/mux_h1.c index b022c0d018..51854f28af 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -4720,6 +4720,11 @@ static int h1_fastfwd(struct stconn *sc, unsigned int count, unsigned int flags) sdo->iobuf.flags &= ~IOBUF_FL_INTERIM_FF; + if (se_fl_test(h1s->sd, SE_FL_EOI)) { + sdo->iobuf.flags |= IOBUF_FL_EOI; /* TODO: it may be good to have a flag to be sure we can + * forward the EOI the to consumer side + */ + } se_done_ff(sdo); ret = total; diff --git a/src/mux_h2.c b/src/mux_h2.c index ab5e3cf60f..024f379ea8 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -7041,21 +7041,8 @@ static size_t h2_done_ff(struct stconn *sc) goto end; head = b_peek(mbuf, b_data(mbuf) - sd->iobuf.data); - /* FIXME: Must be handled with a flag. It is just a temporary hack */ - { - struct xref *peer; - struct sedesc *sdo; - - peer = xref_get_peer_and_lock(&h2s->sd->xref); - if (!peer) - goto end; - - sdo = container_of(peer, struct sedesc, xref); - xref_unlock(&h2s->sd->xref, peer); - - if (se_fl_test(sdo, SE_FL_EOI)) - h2s->flags &= ~H2_SF_MORE_HTX_DATA; - } + if (sd->iobuf.flags & IOBUF_FL_EOI) + h2s->flags &= ~H2_SF_MORE_HTX_DATA; if (!(sd->iobuf.flags & IOBUF_FL_FF_BLOCKED) && !(h2s->flags & H2_SF_BLK_SFCTL) &&