mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
rename DataBlockedFrame.DataLimit to MaximumData
This commit is contained in:
parent
5466de6565
commit
fa07078d81
11 changed files with 18 additions and 18 deletions
|
@ -73,7 +73,7 @@ var _ = Describe("Framer", func() {
|
|||
|
||||
It("adds the right number of frames", func() {
|
||||
maxSize := protocol.ByteCount(1000)
|
||||
bf := &wire.DataBlockedFrame{DataLimit: 0x1337}
|
||||
bf := &wire.DataBlockedFrame{MaximumData: 0x1337}
|
||||
bfLen := bf.Length(version)
|
||||
numFrames := int(maxSize / bfLen) // max number of frames that fit into maxSize
|
||||
for i := 0; i < numFrames+1; i++ {
|
||||
|
|
|
@ -165,10 +165,10 @@ func getFrames() []wire.Frame {
|
|||
MaxStreamNum: protocol.StreamNum(getRandomNumber()),
|
||||
},
|
||||
&wire.DataBlockedFrame{
|
||||
DataLimit: protocol.ByteCount(getRandomNumber()),
|
||||
MaximumData: protocol.ByteCount(getRandomNumber()),
|
||||
},
|
||||
&wire.DataBlockedFrame{
|
||||
DataLimit: protocol.MaxByteCount,
|
||||
MaximumData: protocol.MaxByteCount,
|
||||
},
|
||||
&wire.StreamDataBlockedFrame{
|
||||
StreamID: protocol.StreamID(getRandomNumber()),
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
// A DataBlockedFrame is a DATA_BLOCKED frame
|
||||
type DataBlockedFrame struct {
|
||||
DataLimit protocol.ByteCount
|
||||
MaximumData protocol.ByteCount
|
||||
}
|
||||
|
||||
func parseDataBlockedFrame(r *bytes.Reader, _ protocol.VersionNumber) (*DataBlockedFrame, error) {
|
||||
|
@ -21,18 +21,18 @@ func parseDataBlockedFrame(r *bytes.Reader, _ protocol.VersionNumber) (*DataBloc
|
|||
return nil, err
|
||||
}
|
||||
return &DataBlockedFrame{
|
||||
DataLimit: protocol.ByteCount(offset),
|
||||
MaximumData: protocol.ByteCount(offset),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (f *DataBlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error {
|
||||
typeByte := uint8(0x14)
|
||||
b.WriteByte(typeByte)
|
||||
utils.WriteVarInt(b, uint64(f.DataLimit))
|
||||
utils.WriteVarInt(b, uint64(f.MaximumData))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Length of a written frame
|
||||
func (f *DataBlockedFrame) Length(version protocol.VersionNumber) protocol.ByteCount {
|
||||
return 1 + utils.VarIntLen(uint64(f.DataLimit))
|
||||
return 1 + utils.VarIntLen(uint64(f.MaximumData))
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ var _ = Describe("DATA_BLOCKED frame", func() {
|
|||
b := bytes.NewReader(data)
|
||||
frame, err := parseDataBlockedFrame(b, versionIETFFrames)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.DataLimit).To(Equal(protocol.ByteCount(0x12345678)))
|
||||
Expect(frame.MaximumData).To(Equal(protocol.ByteCount(0x12345678)))
|
||||
Expect(b.Len()).To(BeZero())
|
||||
})
|
||||
|
||||
|
@ -38,7 +38,7 @@ var _ = Describe("DATA_BLOCKED frame", func() {
|
|||
Context("when writing", func() {
|
||||
It("writes a sample frame", func() {
|
||||
b := &bytes.Buffer{}
|
||||
frame := DataBlockedFrame{DataLimit: 0xdeadbeef}
|
||||
frame := DataBlockedFrame{MaximumData: 0xdeadbeef}
|
||||
err := frame.Write(b, protocol.VersionWhatever)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
expected := []byte{0x14}
|
||||
|
@ -47,7 +47,7 @@ var _ = Describe("DATA_BLOCKED frame", func() {
|
|||
})
|
||||
|
||||
It("has the correct min length", func() {
|
||||
frame := DataBlockedFrame{DataLimit: 0x12345}
|
||||
frame := DataBlockedFrame{MaximumData: 0x12345}
|
||||
Expect(frame.Length(versionIETFFrames)).To(Equal(1 + utils.VarIntLen(0x12345)))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -180,7 +180,7 @@ var _ = Describe("Frame parsing", func() {
|
|||
})
|
||||
|
||||
It("unpacks DATA_BLOCKED frames", func() {
|
||||
f := &DataBlockedFrame{DataLimit: 0x1234}
|
||||
f := &DataBlockedFrame{MaximumData: 0x1234}
|
||||
buf := &bytes.Buffer{}
|
||||
err := f.Write(buf, versionIETFFrames)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
|
|
@ -40,7 +40,7 @@ func LogFrame(logger utils.Logger, frame Frame, sent bool) {
|
|||
case *MaxStreamDataFrame:
|
||||
logger.Debugf("\t%s &wire.MaxStreamDataFrame{StreamID: %d, MaximumStreamData: %d}", dir, f.StreamID, f.MaximumStreamData)
|
||||
case *DataBlockedFrame:
|
||||
logger.Debugf("\t%s &wire.DataBlockedFrame{DataLimit: %d}", dir, f.DataLimit)
|
||||
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)
|
||||
case *MaxStreamsFrame:
|
||||
|
|
|
@ -115,10 +115,10 @@ var _ = Describe("Frame logging", func() {
|
|||
|
||||
It("logs DATA_BLOCKED frames", func() {
|
||||
frame := &DataBlockedFrame{
|
||||
DataLimit: 1000,
|
||||
MaximumData: 1000,
|
||||
}
|
||||
LogFrame(logger, frame, false)
|
||||
Expect(buf.String()).To(ContainSubstring("\t<- &wire.DataBlockedFrame{DataLimit: 1000}\n"))
|
||||
Expect(buf.String()).To(ContainSubstring("\t<- &wire.DataBlockedFrame{MaximumData: 1000}\n"))
|
||||
})
|
||||
|
||||
It("logs STREAM_DATA_BLOCKED frames", func() {
|
||||
|
|
|
@ -190,7 +190,7 @@ func marshalMaxStreamsFrame(enc *gojay.Encoder, f *wire.MaxStreamsFrame) {
|
|||
|
||||
func marshalDataBlockedFrame(enc *gojay.Encoder, f *wire.DataBlockedFrame) {
|
||||
enc.StringKey("frame_type", "data_blocked")
|
||||
enc.Int64Key("limit", int64(f.DataLimit))
|
||||
enc.Int64Key("limit", int64(f.MaximumData))
|
||||
}
|
||||
|
||||
func marshalStreamDataBlockedFrame(enc *gojay.Encoder, f *wire.StreamDataBlockedFrame) {
|
||||
|
|
|
@ -215,7 +215,7 @@ var _ = Describe("Frames", func() {
|
|||
It("marshals DATA_BLOCKED frames", func() {
|
||||
check(
|
||||
&wire.DataBlockedFrame{
|
||||
DataLimit: 1337,
|
||||
MaximumData: 1337,
|
||||
},
|
||||
map[string]interface{}{
|
||||
"frame_type": "data_blocked",
|
||||
|
|
|
@ -1504,7 +1504,7 @@ func (s *session) sendProbePacket(encLevel protocol.EncryptionLevel) error {
|
|||
|
||||
func (s *session) sendPacket() (bool, error) {
|
||||
if isBlocked, offset := s.connFlowController.IsNewlyBlocked(); isBlocked {
|
||||
s.framer.QueueControlFrame(&wire.DataBlockedFrame{DataLimit: offset})
|
||||
s.framer.QueueControlFrame(&wire.DataBlockedFrame{MaximumData: offset})
|
||||
}
|
||||
s.windowUpdateQueue.QueueAll()
|
||||
|
||||
|
|
|
@ -1124,7 +1124,7 @@ var _ = Describe("Session", func() {
|
|||
sess.scheduleSending()
|
||||
Eventually(sent).Should(BeClosed())
|
||||
frames, _ := sess.framer.AppendControlFrames(nil, 1000)
|
||||
Expect(frames).To(Equal([]ackhandler.Frame{{Frame: &wire.DataBlockedFrame{DataLimit: 1337}}}))
|
||||
Expect(frames).To(Equal([]ackhandler.Frame{{Frame: &wire.DataBlockedFrame{MaximumData: 1337}}}))
|
||||
})
|
||||
|
||||
It("doesn't send when the SentPacketHandler doesn't allow it", func() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue