]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stconn/mux-h2: Use a iobuf flag to report EOI to consumer side during FF
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 7 Nov 2023 09:56:57 +0000 (10:56 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 8 Nov 2023 20:14:07 +0000 (21:14 +0100)
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.

include/haproxy/stconn-t.h
src/mux_h1.c
src/mux_h2.c

index ce06a5cce07137d91d11a9c3518363428115ae61..30f468ad7fd3c0ec5eb74bbb0a67cbbf905ee5e0 100644 (file)
@@ -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 {
index b022c0d018d572c8fe76cb2f4a15b80e51c77cc2..51854f28afad0728d0f99667fbcd35fb4d2d844c 100644 (file)
@@ -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;
index ab5e3cf60f75f3c634ce65cdf684ea01c56e8fb6..024f379ea87675b679b3e81babd6c6de464525db 100644 (file)
@@ -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) &&