mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
rename MaxDataFrame.ByteOffset to MaximumData
This commit is contained in:
parent
00f8028e52
commit
f4519cfd32
16 changed files with 32 additions and 32 deletions
|
@ -38,7 +38,7 @@ var _ = Describe("Framer", func() {
|
|||
|
||||
Context("handling control frames", func() {
|
||||
It("adds control frames", func() {
|
||||
mdf := &wire.MaxDataFrame{ByteOffset: 0x42}
|
||||
mdf := &wire.MaxDataFrame{MaximumData: 0x42}
|
||||
msf := &wire.MaxStreamsFrame{MaxStreamNum: 0x1337}
|
||||
framer.QueueControlFrame(mdf)
|
||||
framer.QueueControlFrame(msf)
|
||||
|
@ -52,7 +52,7 @@ var _ = Describe("Framer", func() {
|
|||
|
||||
It("says if it has data", func() {
|
||||
Expect(framer.HasData()).To(BeFalse())
|
||||
f := &wire.MaxDataFrame{ByteOffset: 0x42}
|
||||
f := &wire.MaxDataFrame{MaximumData: 0x42}
|
||||
framer.QueueControlFrame(f)
|
||||
Expect(framer.HasData()).To(BeTrue())
|
||||
frames, _ := framer.AppendControlFrames(nil, 1000)
|
||||
|
@ -62,7 +62,7 @@ var _ = Describe("Framer", func() {
|
|||
|
||||
It("appends to the slice given", func() {
|
||||
ping := &wire.PingFrame{}
|
||||
mdf := &wire.MaxDataFrame{ByteOffset: 0x42}
|
||||
mdf := &wire.MaxDataFrame{MaximumData: 0x42}
|
||||
framer.QueueControlFrame(mdf)
|
||||
frames, length := framer.AppendControlFrames([]ackhandler.Frame{{Frame: ping}}, 1000)
|
||||
Expect(frames).To(HaveLen(2))
|
||||
|
@ -137,7 +137,7 @@ var _ = Describe("Framer", func() {
|
|||
}
|
||||
stream1.EXPECT().popStreamFrame(gomock.Any()).Return(&ackhandler.Frame{Frame: f}, false)
|
||||
framer.AddActiveStream(id1)
|
||||
mdf := &wire.MaxDataFrame{ByteOffset: 1337}
|
||||
mdf := &wire.MaxDataFrame{MaximumData: 1337}
|
||||
frames := []ackhandler.Frame{{Frame: mdf}}
|
||||
fs, length := framer.AppendStreamFrames(frames, 1000)
|
||||
Expect(fs).To(HaveLen(2))
|
||||
|
|
|
@ -143,10 +143,10 @@ func getFrames() []wire.Frame {
|
|||
Token: getRandomData(10),
|
||||
},
|
||||
&wire.MaxDataFrame{
|
||||
ByteOffset: protocol.ByteCount(getRandomNumber()),
|
||||
MaximumData: protocol.ByteCount(getRandomNumber()),
|
||||
},
|
||||
&wire.MaxDataFrame{
|
||||
ByteOffset: protocol.MaxByteCount,
|
||||
MaximumData: protocol.MaxByteCount,
|
||||
},
|
||||
&wire.MaxStreamDataFrame{
|
||||
StreamID: protocol.StreamID(getRandomNumber()),
|
||||
|
|
|
@ -143,7 +143,7 @@ var _ = Describe("Frame parsing", func() {
|
|||
|
||||
It("unpacks MAX_DATA frames", func() {
|
||||
f := &MaxDataFrame{
|
||||
ByteOffset: 0xcafe,
|
||||
MaximumData: 0xcafe,
|
||||
}
|
||||
buf := &bytes.Buffer{}
|
||||
err := f.Write(buf, versionIETFFrames)
|
||||
|
|
|
@ -36,7 +36,7 @@ func LogFrame(logger utils.Logger, frame Frame, sent bool) {
|
|||
logger.Debugf("\t%s &wire.AckFrame{LargestAcked: %d, LowestAcked: %d, DelayTime: %s}", dir, f.LargestAcked(), f.LowestAcked(), f.DelayTime.String())
|
||||
}
|
||||
case *MaxDataFrame:
|
||||
logger.Debugf("\t%s &wire.MaxDataFrame{ByteOffset: %d}", dir, f.ByteOffset)
|
||||
logger.Debugf("\t%s &wire.MaxDataFrame{MaximumData: %d}", dir, f.MaximumData)
|
||||
case *MaxStreamDataFrame:
|
||||
logger.Debugf("\t%s &wire.MaxStreamDataFrame{StreamID: %d, ByteOffset: %d}", dir, f.StreamID, f.ByteOffset)
|
||||
case *DataBlockedFrame:
|
||||
|
|
|
@ -98,10 +98,10 @@ var _ = Describe("Frame logging", func() {
|
|||
|
||||
It("logs MAX_DATA frames", func() {
|
||||
frame := &MaxDataFrame{
|
||||
ByteOffset: 42,
|
||||
MaximumData: 42,
|
||||
}
|
||||
LogFrame(logger, frame, false)
|
||||
Expect(buf.String()).To(ContainSubstring("\t<- &wire.MaxDataFrame{ByteOffset: 42}\n"))
|
||||
Expect(buf.String()).To(ContainSubstring("\t<- &wire.MaxDataFrame{MaximumData: 42}\n"))
|
||||
})
|
||||
|
||||
It("logs MAX_STREAM_DATA frames", func() {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
// A MaxDataFrame carries flow control information for the connection
|
||||
type MaxDataFrame struct {
|
||||
ByteOffset protocol.ByteCount
|
||||
MaximumData protocol.ByteCount
|
||||
}
|
||||
|
||||
// parseMaxDataFrame parses a MAX_DATA frame
|
||||
|
@ -23,18 +23,18 @@ func parseMaxDataFrame(r *bytes.Reader, _ protocol.VersionNumber) (*MaxDataFrame
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
frame.ByteOffset = protocol.ByteCount(byteOffset)
|
||||
frame.MaximumData = protocol.ByteCount(byteOffset)
|
||||
return frame, nil
|
||||
}
|
||||
|
||||
//Write writes a MAX_STREAM_DATA frame
|
||||
func (f *MaxDataFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error {
|
||||
b.WriteByte(0x10)
|
||||
utils.WriteVarInt(b, uint64(f.ByteOffset))
|
||||
utils.WriteVarInt(b, uint64(f.MaximumData))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Length of a written frame
|
||||
func (f *MaxDataFrame) Length(version protocol.VersionNumber) protocol.ByteCount {
|
||||
return 1 + utils.VarIntLen(uint64(f.ByteOffset))
|
||||
return 1 + utils.VarIntLen(uint64(f.MaximumData))
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ var _ = Describe("MAX_DATA frame", func() {
|
|||
b := bytes.NewReader(data)
|
||||
frame, err := parseMaxDataFrame(b, versionIETFFrames)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.ByteOffset).To(Equal(protocol.ByteCount(0xdecafbad123456)))
|
||||
Expect(frame.MaximumData).To(Equal(protocol.ByteCount(0xdecafbad123456)))
|
||||
Expect(b.Len()).To(BeZero())
|
||||
})
|
||||
|
||||
|
@ -36,7 +36,7 @@ var _ = Describe("MAX_DATA frame", func() {
|
|||
Context("writing", func() {
|
||||
It("has proper min length", func() {
|
||||
f := &MaxDataFrame{
|
||||
ByteOffset: 0xdeadbeef,
|
||||
MaximumData: 0xdeadbeef,
|
||||
}
|
||||
Expect(f.Length(versionIETFFrames)).To(Equal(1 + utils.VarIntLen(0xdeadbeef)))
|
||||
})
|
||||
|
@ -44,7 +44,7 @@ var _ = Describe("MAX_DATA frame", func() {
|
|||
It("writes a MAX_DATA frame", func() {
|
||||
b := &bytes.Buffer{}
|
||||
f := &MaxDataFrame{
|
||||
ByteOffset: 0xdeadbeefcafe,
|
||||
MaximumData: 0xdeadbeefcafe,
|
||||
}
|
||||
err := f.Write(b, versionIETFFrames)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
|
|
@ -259,7 +259,7 @@ var _ = Describe("Packet packer", func() {
|
|||
sealingManager.EXPECT().Get0RTTSealer().Return(getSealer(), nil).AnyTimes()
|
||||
pnManager.EXPECT().PeekPacketNumber(protocol.Encryption0RTT).Return(protocol.PacketNumber(0x42), protocol.PacketNumberLen2)
|
||||
pnManager.EXPECT().PopPacketNumber(protocol.Encryption0RTT).Return(protocol.PacketNumber(0x42))
|
||||
cf := ackhandler.Frame{Frame: &wire.MaxDataFrame{ByteOffset: 0x1337}}
|
||||
cf := ackhandler.Frame{Frame: &wire.MaxDataFrame{MaximumData: 0x1337}}
|
||||
framer.EXPECT().HasData().Return(true)
|
||||
framer.EXPECT().AppendControlFrames(nil, gomock.Any()).DoAndReturn(func(frames []ackhandler.Frame, _ protocol.ByteCount) ([]ackhandler.Frame, protocol.ByteCount) {
|
||||
return append(frames, cf), cf.Length(packer.version)
|
||||
|
|
|
@ -173,7 +173,7 @@ func marshalStreamFrame(enc *gojay.Encoder, f *streamFrame) {
|
|||
|
||||
func marshalMaxDataFrame(enc *gojay.Encoder, f *wire.MaxDataFrame) {
|
||||
enc.StringKey("frame_type", "max_data")
|
||||
enc.Int64Key("maximum", int64(f.ByteOffset))
|
||||
enc.Int64Key("maximum", int64(f.MaximumData))
|
||||
}
|
||||
|
||||
func marshalMaxStreamDataFrame(enc *gojay.Encoder, f *wire.MaxStreamDataFrame) {
|
||||
|
|
|
@ -175,7 +175,7 @@ var _ = Describe("Frames", func() {
|
|||
It("marshals MAX_DATA frames", func() {
|
||||
check(
|
||||
&wire.MaxDataFrame{
|
||||
ByteOffset: 1337,
|
||||
MaximumData: 1337,
|
||||
},
|
||||
map[string]interface{}{
|
||||
"frame_type": "max_data",
|
||||
|
|
|
@ -300,7 +300,7 @@ var _ = Describe("Tracer", func() {
|
|||
},
|
||||
123,
|
||||
&wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 10}}},
|
||||
[]wire.Frame{&wire.MaxDataFrame{ByteOffset: 987}},
|
||||
[]wire.Frame{&wire.MaxDataFrame{MaximumData: 987}},
|
||||
)
|
||||
entry := exportAndParseSingle()
|
||||
ev := entry.Event
|
||||
|
|
|
@ -24,7 +24,7 @@ var _ = Describe("Retransmission queue", func() {
|
|||
})
|
||||
|
||||
It("queues and retrieves a control frame", func() {
|
||||
f := &wire.MaxDataFrame{ByteOffset: 0x42}
|
||||
f := &wire.MaxDataFrame{MaximumData: 0x42}
|
||||
q.AddInitial(f)
|
||||
Expect(q.HasInitialData()).To(BeTrue())
|
||||
Expect(q.GetInitialFrame(f.Length(version) - 1)).To(BeNil())
|
||||
|
@ -74,7 +74,7 @@ var _ = Describe("Retransmission queue", func() {
|
|||
})
|
||||
|
||||
It("retrieves both a CRYPTO frame and a control frame", func() {
|
||||
cf := &wire.MaxDataFrame{ByteOffset: 0x42}
|
||||
cf := &wire.MaxDataFrame{MaximumData: 0x42}
|
||||
f := &wire.CryptoFrame{Data: []byte("foobar")}
|
||||
q.AddInitial(f)
|
||||
q.AddInitial(cf)
|
||||
|
@ -86,7 +86,7 @@ var _ = Describe("Retransmission queue", func() {
|
|||
|
||||
It("drops all Initial frames", func() {
|
||||
q.AddInitial(&wire.CryptoFrame{Data: []byte("foobar")})
|
||||
q.AddInitial(&wire.MaxDataFrame{ByteOffset: 0x42})
|
||||
q.AddInitial(&wire.MaxDataFrame{MaximumData: 0x42})
|
||||
q.DropPackets(protocol.EncryptionInitial)
|
||||
Expect(q.HasInitialData()).To(BeFalse())
|
||||
Expect(q.GetInitialFrame(protocol.MaxByteCount)).To(BeNil())
|
||||
|
@ -100,7 +100,7 @@ var _ = Describe("Retransmission queue", func() {
|
|||
})
|
||||
|
||||
It("queues and retrieves a control frame", func() {
|
||||
f := &wire.MaxDataFrame{ByteOffset: 0x42}
|
||||
f := &wire.MaxDataFrame{MaximumData: 0x42}
|
||||
q.AddHandshake(f)
|
||||
Expect(q.HasHandshakeData()).To(BeTrue())
|
||||
Expect(q.GetHandshakeFrame(f.Length(version) - 1)).To(BeNil())
|
||||
|
@ -150,7 +150,7 @@ var _ = Describe("Retransmission queue", func() {
|
|||
})
|
||||
|
||||
It("retrieves both a CRYPTO frame and a control frame", func() {
|
||||
cf := &wire.MaxDataFrame{ByteOffset: 0x42}
|
||||
cf := &wire.MaxDataFrame{MaximumData: 0x42}
|
||||
f := &wire.CryptoFrame{Data: []byte("foobar")}
|
||||
q.AddHandshake(f)
|
||||
q.AddHandshake(cf)
|
||||
|
@ -162,7 +162,7 @@ var _ = Describe("Retransmission queue", func() {
|
|||
|
||||
It("drops all Handshake frames", func() {
|
||||
q.AddHandshake(&wire.CryptoFrame{Data: []byte("foobar")})
|
||||
q.AddHandshake(&wire.MaxDataFrame{ByteOffset: 0x42})
|
||||
q.AddHandshake(&wire.MaxDataFrame{MaximumData: 0x42})
|
||||
q.DropPackets(protocol.EncryptionHandshake)
|
||||
Expect(q.HasHandshakeData()).To(BeFalse())
|
||||
Expect(q.GetHandshakeFrame(protocol.MaxByteCount)).To(BeNil())
|
||||
|
@ -175,7 +175,7 @@ var _ = Describe("Retransmission queue", func() {
|
|||
})
|
||||
|
||||
It("queues and retrieves a control frame", func() {
|
||||
f := &wire.MaxDataFrame{ByteOffset: 0x42}
|
||||
f := &wire.MaxDataFrame{MaximumData: 0x42}
|
||||
Expect(q.HasAppData()).To(BeFalse())
|
||||
q.AddAppData(f)
|
||||
Expect(q.HasAppData()).To(BeTrue())
|
||||
|
|
|
@ -1143,7 +1143,7 @@ func (s *session) handleStreamFrame(frame *wire.StreamFrame) error {
|
|||
}
|
||||
|
||||
func (s *session) handleMaxDataFrame(frame *wire.MaxDataFrame) {
|
||||
s.connFlowController.UpdateSendWindow(frame.ByteOffset)
|
||||
s.connFlowController.UpdateSendWindow(frame.MaximumData)
|
||||
}
|
||||
|
||||
func (s *session) handleMaxStreamDataFrame(frame *wire.MaxStreamDataFrame) error {
|
||||
|
|
|
@ -225,7 +225,7 @@ var _ = Describe("Session", func() {
|
|||
It("updates the flow control window of the connection", func() {
|
||||
offset := protocol.ByteCount(0x800000)
|
||||
connFC.EXPECT().UpdateSendWindow(offset)
|
||||
sess.handleMaxDataFrame(&wire.MaxDataFrame{ByteOffset: offset})
|
||||
sess.handleMaxDataFrame(&wire.MaxDataFrame{MaximumData: offset})
|
||||
})
|
||||
|
||||
It("ignores MAX_STREAM_DATA frames for a closed stream", func() {
|
||||
|
|
|
@ -48,7 +48,7 @@ func (q *windowUpdateQueue) QueueAll() {
|
|||
q.mutex.Lock()
|
||||
// queue a connection-level window update
|
||||
if q.queuedConn {
|
||||
q.callback(&wire.MaxDataFrame{ByteOffset: q.connFlowController.GetWindowUpdate()})
|
||||
q.callback(&wire.MaxDataFrame{MaximumData: q.connFlowController.GetWindowUpdate()})
|
||||
q.queuedConn = false
|
||||
}
|
||||
// queue all stream-level window updates
|
||||
|
|
|
@ -94,7 +94,7 @@ var _ = Describe("Window Update Queue", func() {
|
|||
q.AddConnection()
|
||||
q.QueueAll()
|
||||
Expect(queuedFrames).To(Equal([]wire.Frame{
|
||||
&wire.MaxDataFrame{ByteOffset: 0x1337},
|
||||
&wire.MaxDataFrame{MaximumData: 0x1337},
|
||||
}))
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue