From 73d82efb96cacc0c378bc150b56675fc191894b9 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Wed, 4 Oct 2023 12:03:01 -0700 Subject: [PATCH] quic: handle DATA_BLOCKED frames We never send DATA_BLOCKED frames, and ignore ones sent by the peer, but we do need to parse them. For golang/go#58547 Change-Id: Ic9893245108fd1c32067d14811e2d44488ce1ab5 Reviewed-on: https://go-review.googlesource.com/c/net/+/532715 LUCI-TryBot-Result: Go LUCI Reviewed-by: Jonathan Amsterdam --- internal/quic/conn_recv.go | 5 +++++ internal/quic/stream_test.go | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/internal/quic/conn_recv.go b/internal/quic/conn_recv.go index 19c43858c5..9b1ba1ae10 100644 --- a/internal/quic/conn_recv.go +++ b/internal/quic/conn_recv.go @@ -254,6 +254,11 @@ func (c *Conn) handleFrames(now time.Time, ptype packetType, space numberSpace, return } n = c.handleMaxStreamsFrame(now, payload) + case frameTypeDataBlocked: + if !frameOK(c, ptype, __01) { + return + } + _, n = consumeDataBlockedFrame(payload) case frameTypeStreamsBlockedBidi, frameTypeStreamsBlockedUni: if !frameOK(c, ptype, __01) { return diff --git a/internal/quic/stream_test.go b/internal/quic/stream_test.go index 750119614b..86eebc6989 100644 --- a/internal/quic/stream_test.go +++ b/internal/quic/stream_test.go @@ -1217,6 +1217,23 @@ func TestStreamPeerStopSendingForActiveStream(t *testing.T) { }) } +func TestStreamReceiveDataBlocked(t *testing.T) { + tc := newTestConn(t, serverSide, permissiveTransportParameters) + tc.handshake() + tc.ignoreFrame(frameTypeAck) + + // We don't do anything with these frames, + // but should accept them if the peer sends one. + tc.writeFrames(packetType1RTT, debugFrameStreamDataBlocked{ + id: newStreamID(clientSide, bidiStream, 0), + max: 100, + }) + tc.writeFrames(packetType1RTT, debugFrameDataBlocked{ + max: 100, + }) + tc.wantIdle("no response to STREAM_DATA_BLOCKED and DATA_BLOCKED") +} + type streamSide string const (