diff --git a/internal/quic/conn_flow.go b/internal/quic/conn_flow.go index 281c7084ff..4f1ab6eafc 100644 --- a/internal/quic/conn_flow.go +++ b/internal/quic/conn_flow.go @@ -106,6 +106,7 @@ func (c *Conn) appendMaxDataFrame(w *packetWriter, pnum packetNumber, pto bool) if !w.appendMaxDataFrame(c.streams.inflow.newLimit) { return false } + c.streams.inflow.sentLimit += c.streams.inflow.newLimit c.streams.inflow.sent.setSent(pnum) } return true diff --git a/internal/quic/conn_flow_test.go b/internal/quic/conn_flow_test.go index 45c82f60d2..d5ee74ebda 100644 --- a/internal/quic/conn_flow_test.go +++ b/internal/quic/conn_flow_test.go @@ -35,6 +35,16 @@ func TestConnInflowReturnOnRead(t *testing.T) { packetType1RTT, debugFrameMaxData{ max: 128, }) + // Peer can write up to the new limit. + tc.writeFrames(packetType1RTT, debugFrameStream{ + id: s.id, + off: 64, + data: make([]byte, 64), + }) + tc.wantIdle("connection is idle") + if n, err := s.ReadContext(ctx, make([]byte, 64)); n != 64 || err != nil { + t.Fatalf("offset 64: s.Read() = %v, %v; want %v, nil", n, err, 64) + } } func TestConnInflowReturnOnRacingReads(t *testing.T) {