diff --git a/fuzzing/frames/main.go b/fuzzing/frames/main.go index 294a3326..cf77d0df 100644 --- a/fuzzing/frames/main.go +++ b/fuzzing/frames/main.go @@ -171,12 +171,12 @@ func getFrames() []wire.Frame { MaximumData: protocol.MaxByteCount, }, &wire.StreamDataBlockedFrame{ - StreamID: protocol.StreamID(getRandomNumber()), - DataLimit: protocol.ByteCount(getRandomNumber()), + StreamID: protocol.StreamID(getRandomNumber()), + MaximumStreamData: protocol.ByteCount(getRandomNumber()), }, &wire.StreamDataBlockedFrame{ - StreamID: protocol.StreamID(getRandomNumber()), - DataLimit: protocol.MaxByteCount, + StreamID: protocol.StreamID(getRandomNumber()), + MaximumStreamData: protocol.MaxByteCount, }, &wire.StreamsBlockedFrame{ Type: protocol.StreamTypeUni, diff --git a/internal/wire/frame_parser_test.go b/internal/wire/frame_parser_test.go index 509a1c2c..76239a12 100644 --- a/internal/wire/frame_parser_test.go +++ b/internal/wire/frame_parser_test.go @@ -191,8 +191,8 @@ var _ = Describe("Frame parsing", func() { It("unpacks STREAM_DATA_BLOCKED frames", func() { f := &StreamDataBlockedFrame{ - StreamID: 0xdeadbeef, - DataLimit: 0xdead, + StreamID: 0xdeadbeef, + MaximumStreamData: 0xdead, } err := f.Write(buf, versionIETFFrames) Expect(err).ToNot(HaveOccurred()) diff --git a/internal/wire/log.go b/internal/wire/log.go index 0a5cad78..9549bd0e 100644 --- a/internal/wire/log.go +++ b/internal/wire/log.go @@ -42,7 +42,7 @@ func LogFrame(logger utils.Logger, frame Frame, sent bool) { case *DataBlockedFrame: logger.Debugf("\t%s &wire.DataBlockedFrame{MaximumData: %d}", dir, f.MaximumData) case *StreamDataBlockedFrame: - logger.Debugf("\t%s &wire.StreamDataBlockedFrame{StreamID: %d, DataLimit: %d}", dir, f.StreamID, f.DataLimit) + logger.Debugf("\t%s &wire.StreamDataBlockedFrame{StreamID: %d, MaximumStreamData: %d}", dir, f.StreamID, f.MaximumStreamData) case *MaxStreamsFrame: switch f.Type { case protocol.StreamTypeUni: diff --git a/internal/wire/log_test.go b/internal/wire/log_test.go index 9e8736f0..cddf26e3 100644 --- a/internal/wire/log_test.go +++ b/internal/wire/log_test.go @@ -123,11 +123,11 @@ var _ = Describe("Frame logging", func() { It("logs STREAM_DATA_BLOCKED frames", func() { frame := &StreamDataBlockedFrame{ - StreamID: 42, - DataLimit: 1000, + StreamID: 42, + MaximumStreamData: 1000, } LogFrame(logger, frame, false) - Expect(buf.String()).To(ContainSubstring("\t<- &wire.StreamDataBlockedFrame{StreamID: 42, DataLimit: 1000}\n")) + Expect(buf.String()).To(ContainSubstring("\t<- &wire.StreamDataBlockedFrame{StreamID: 42, MaximumStreamData: 1000}\n")) }) It("logs STREAMS_BLOCKED frames", func() { diff --git a/internal/wire/stream_data_blocked_frame.go b/internal/wire/stream_data_blocked_frame.go index 9f2e90be..337d10ef 100644 --- a/internal/wire/stream_data_blocked_frame.go +++ b/internal/wire/stream_data_blocked_frame.go @@ -9,8 +9,8 @@ import ( // A StreamDataBlockedFrame is a STREAM_DATA_BLOCKED frame type StreamDataBlockedFrame struct { - StreamID protocol.StreamID - DataLimit protocol.ByteCount + StreamID protocol.StreamID + MaximumStreamData protocol.ByteCount } func parseStreamDataBlockedFrame(r *bytes.Reader, _ protocol.VersionNumber) (*StreamDataBlockedFrame, error) { @@ -28,19 +28,19 @@ func parseStreamDataBlockedFrame(r *bytes.Reader, _ protocol.VersionNumber) (*St } return &StreamDataBlockedFrame{ - StreamID: protocol.StreamID(sid), - DataLimit: protocol.ByteCount(offset), + StreamID: protocol.StreamID(sid), + MaximumStreamData: protocol.ByteCount(offset), }, nil } func (f *StreamDataBlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error { b.WriteByte(0x15) utils.WriteVarInt(b, uint64(f.StreamID)) - utils.WriteVarInt(b, uint64(f.DataLimit)) + utils.WriteVarInt(b, uint64(f.MaximumStreamData)) return nil } // Length of a written frame func (f *StreamDataBlockedFrame) Length(version protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(uint64(f.StreamID)) + utils.VarIntLen(uint64(f.DataLimit)) + return 1 + utils.VarIntLen(uint64(f.StreamID)) + utils.VarIntLen(uint64(f.MaximumStreamData)) } diff --git a/internal/wire/stream_data_blocked_frame_test.go b/internal/wire/stream_data_blocked_frame_test.go index c264980d..2d9f9a1b 100644 --- a/internal/wire/stream_data_blocked_frame_test.go +++ b/internal/wire/stream_data_blocked_frame_test.go @@ -20,7 +20,7 @@ var _ = Describe("STREAM_DATA_BLOCKED frame", func() { frame, err := parseStreamDataBlockedFrame(b, versionIETFFrames) Expect(err).ToNot(HaveOccurred()) Expect(frame.StreamID).To(Equal(protocol.StreamID(0xdeadbeef))) - Expect(frame.DataLimit).To(Equal(protocol.ByteCount(0xdecafbad))) + Expect(frame.MaximumStreamData).To(Equal(protocol.ByteCount(0xdecafbad))) Expect(b.Len()).To(BeZero()) }) @@ -40,8 +40,8 @@ var _ = Describe("STREAM_DATA_BLOCKED frame", func() { Context("writing", func() { It("has proper min length", func() { f := &StreamDataBlockedFrame{ - StreamID: 0x1337, - DataLimit: 0xdeadbeef, + StreamID: 0x1337, + MaximumStreamData: 0xdeadbeef, } Expect(f.Length(0)).To(Equal(1 + utils.VarIntLen(0x1337) + utils.VarIntLen(0xdeadbeef))) }) @@ -49,14 +49,14 @@ var _ = Describe("STREAM_DATA_BLOCKED frame", func() { It("writes a sample frame", func() { b := &bytes.Buffer{} f := &StreamDataBlockedFrame{ - StreamID: 0xdecafbad, - DataLimit: 0x1337, + StreamID: 0xdecafbad, + MaximumStreamData: 0x1337, } err := f.Write(b, versionIETFFrames) Expect(err).ToNot(HaveOccurred()) expected := []byte{0x15} expected = append(expected, encodeVarInt(uint64(f.StreamID))...) - expected = append(expected, encodeVarInt(uint64(f.DataLimit))...) + expected = append(expected, encodeVarInt(uint64(f.MaximumStreamData))...) Expect(b.Bytes()).To(Equal(expected)) }) }) diff --git a/qlog/frame.go b/qlog/frame.go index 9dce97ab..61fd139f 100644 --- a/qlog/frame.go +++ b/qlog/frame.go @@ -196,7 +196,7 @@ func marshalDataBlockedFrame(enc *gojay.Encoder, f *wire.DataBlockedFrame) { func marshalStreamDataBlockedFrame(enc *gojay.Encoder, f *wire.StreamDataBlockedFrame) { enc.StringKey("frame_type", "stream_data_blocked") enc.Int64Key("stream_id", int64(f.StreamID)) - enc.Int64Key("limit", int64(f.DataLimit)) + enc.Int64Key("limit", int64(f.MaximumStreamData)) } func marshalStreamsBlockedFrame(enc *gojay.Encoder, f *wire.StreamsBlockedFrame) { diff --git a/qlog/frame_test.go b/qlog/frame_test.go index 4ee714a7..bf9d8adf 100644 --- a/qlog/frame_test.go +++ b/qlog/frame_test.go @@ -227,8 +227,8 @@ var _ = Describe("Frames", func() { It("marshals STREAM_DATA_BLOCKED frames", func() { check( &wire.StreamDataBlockedFrame{ - StreamID: 42, - DataLimit: 1337, + StreamID: 42, + MaximumStreamData: 1337, }, map[string]interface{}{ "frame_type": "stream_data_blocked", diff --git a/send_stream.go b/send_stream.go index 6f57eaef..d34cb8c6 100644 --- a/send_stream.go +++ b/send_stream.go @@ -242,8 +242,8 @@ func (s *sendStream) popNewOrRetransmittedStreamFrame(maxBytes protocol.ByteCoun if sendWindow == 0 { if isBlocked, offset := s.flowController.IsNewlyBlocked(); isBlocked { s.sender.queueControlFrame(&wire.StreamDataBlockedFrame{ - StreamID: s.streamID, - DataLimit: offset, + StreamID: s.streamID, + MaximumStreamData: offset, }) return nil, false } diff --git a/send_stream_test.go b/send_stream_test.go index 5192ec06..41eca8f5 100644 --- a/send_stream_test.go +++ b/send_stream_test.go @@ -311,8 +311,8 @@ var _ = Describe("Send Stream", func() { mockFC.EXPECT().SendWindowSize().Return(protocol.ByteCount(0)) mockFC.EXPECT().IsNewlyBlocked().Return(true, protocol.ByteCount(12)) mockSender.EXPECT().queueControlFrame(&wire.StreamDataBlockedFrame{ - StreamID: streamID, - DataLimit: 12, + StreamID: streamID, + MaximumStreamData: 12, }) done := make(chan struct{}) go func() { @@ -354,8 +354,8 @@ var _ = Describe("Send Stream", func() { // don't use offset 3 here, to make sure the BLOCKED frame contains the number returned by the flow controller mockFC.EXPECT().IsNewlyBlocked().Return(true, protocol.ByteCount(10)) mockSender.EXPECT().queueControlFrame(&wire.StreamDataBlockedFrame{ - StreamID: streamID, - DataLimit: 10, + StreamID: streamID, + MaximumStreamData: 10, }) f, hasMoreData = str.popStreamFrame(1000) Expect(f).To(BeNil())