Skip to content

Commit 350aad2

Browse files
committed
quic: correctly extend peer's flow control window after MAX_DATA
When sending the peer a connection-level flow control update in a MAX_DATA frame, we weren't recording the updated limit locally. When the peer wrote data past the old limit, we would incorrectly close the connection with a FLOW_CONTROL_ERROR. For golang/go#58547 Change-Id: I6879c0cccc3cfdc673b613a07b038138d9e285ff Reviewed-on: https://go-review.googlesource.com/c/net/+/530075 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
1 parent 21814e7 commit 350aad2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

internal/quic/conn_flow.go

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func (c *Conn) appendMaxDataFrame(w *packetWriter, pnum packetNumber, pto bool)
106106
if !w.appendMaxDataFrame(c.streams.inflow.newLimit) {
107107
return false
108108
}
109+
c.streams.inflow.sentLimit += c.streams.inflow.newLimit
109110
c.streams.inflow.sent.setSent(pnum)
110111
}
111112
return true

internal/quic/conn_flow_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ func TestConnInflowReturnOnRead(t *testing.T) {
3535
packetType1RTT, debugFrameMaxData{
3636
max: 128,
3737
})
38+
// Peer can write up to the new limit.
39+
tc.writeFrames(packetType1RTT, debugFrameStream{
40+
id: s.id,
41+
off: 64,
42+
data: make([]byte, 64),
43+
})
44+
tc.wantIdle("connection is idle")
45+
if n, err := s.ReadContext(ctx, make([]byte, 64)); n != 64 || err != nil {
46+
t.Fatalf("offset 64: s.Read() = %v, %v; want %v, nil", n, err, 64)
47+
}
3848
}
3949

4050
func TestConnInflowReturnOnRacingReads(t *testing.T) {

0 commit comments

Comments
 (0)