]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h2: Remove H2S from send list if data are sent via 0-copy FF
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Oct 2024 05:56:39 +0000 (07:56 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Oct 2024 06:00:32 +0000 (08:00 +0200)
When data are sent via the zero-copy data forwarding, in h2_done_ff, we must
be sure to remove the H2 stream from the send list if something is send. It
was only performed if no blocking condition was encountered. But we must
also do it if something is sent. Otherwise the transfer may be blocked till
timeout.

This patch must be backported as far as 2.9.

src/mux_h2.c

index 74fb3674610815ae19ac3f49e86514139c336f55..453282f1b768d89151c4cc3bdcd18fc050902488 100644 (file)
@@ -7860,13 +7860,6 @@ static size_t h2_done_ff(struct stconn *sc)
                h2s->flags &= ~H2_SF_MORE_HTX_DATA;
        }
 
-       if (!(sd->iobuf.flags & IOBUF_FL_FF_BLOCKED) &&
-           !(h2s->flags & H2_SF_BLK_SFCTL) &&
-           !(h2s->flags & (H2_SF_WANT_SHUTR|H2_SF_WANT_SHUTW))) {
-               /* Ok we managed to send something, leave the send_list if we were still there */
-               h2_remove_from_list(h2s);
-       }
-
        if (!sd->iobuf.data)
                goto end;
 
@@ -7901,6 +7894,13 @@ static size_t h2_done_ff(struct stconn *sc)
        if (!(sd->iobuf.flags & IOBUF_FL_INTERIM_FF))
            h2s->flags &= ~H2_SF_NOTIFIED;
 
+       if ((total || !(sd->iobuf.flags & IOBUF_FL_FF_BLOCKED)) &&
+           !(h2s->flags & H2_SF_BLK_SFCTL) &&
+           !(h2s->flags & (H2_SF_WANT_SHUTR|H2_SF_WANT_SHUTW))) {
+               /* Ok we managed to send something, leave the send_list if we were still there */
+               h2_remove_from_list(h2s);
+       }
+
        TRACE_LEAVE(H2_EV_H2S_SEND|H2_EV_STRM_SEND, h2s->h2c->conn, h2s);
        return total;
 }