Skip to content

Commit

Permalink
quic: handle DATA_BLOCKED frames
Browse files Browse the repository at this point in the history
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
  • Loading branch information
neild committed Oct 5, 2023
1 parent 5d5a036 commit 73d82ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/quic/conn_recv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions internal/quic/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 73d82ef

Please sign in to comment.