mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
rename StreamFrame.FinBit to Fin
This commit is contained in:
parent
865332015c
commit
838dd6e81a
14 changed files with 64 additions and 64 deletions
|
@ -70,11 +70,11 @@ func getFrames() []wire.Frame {
|
|||
frames := []wire.Frame{
|
||||
&wire.StreamFrame{ // STREAM frame at 0 offset, with FIN bit
|
||||
StreamID: protocol.StreamID(getRandomNumber()),
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
},
|
||||
&wire.StreamFrame{ // STREAM frame at 0 offset, with data and FIN bit
|
||||
StreamID: protocol.StreamID(getRandomNumber()),
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
Data: getRandomData(100),
|
||||
},
|
||||
&wire.StreamFrame{ // STREAM frame at non-zero offset, with data
|
||||
|
@ -86,19 +86,19 @@ func getFrames() []wire.Frame {
|
|||
StreamID: protocol.StreamID(getRandomNumber()),
|
||||
Offset: protocol.ByteCount(getRandomNumber()),
|
||||
Data: getRandomData(50),
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
},
|
||||
&wire.StreamFrame{ // STREAM frame at non-zero offset, with data and FIN bit. Long enough to use the buffer.
|
||||
StreamID: protocol.StreamID(getRandomNumber()),
|
||||
Offset: protocol.ByteCount(getRandomNumber()),
|
||||
Data: getRandomData(2 * protocol.MinStreamFrameBufferSize),
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
},
|
||||
&wire.StreamFrame{ // STREAM frame at maximum offset, with FIN bit
|
||||
StreamID: protocol.StreamID(getRandomNumber()),
|
||||
Offset: protocol.MaxByteCount - 5,
|
||||
Data: getRandomData(5),
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
},
|
||||
&wire.StreamFrame{ // STREAM frame with data at maximum offset
|
||||
StreamID: protocol.StreamID(getRandomNumber()),
|
||||
|
|
|
@ -130,7 +130,7 @@ var _ = Describe("Frame parsing", func() {
|
|||
f := &StreamFrame{
|
||||
StreamID: 0x42,
|
||||
Offset: 0x1337,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
Data: []byte("foobar"),
|
||||
}
|
||||
err := f.Write(buf, versionIETFFrames)
|
||||
|
|
|
@ -22,7 +22,7 @@ func LogFrame(logger utils.Logger, frame Frame, sent bool) {
|
|||
dataLen := protocol.ByteCount(len(f.Data))
|
||||
logger.Debugf("\t%s &wire.CryptoFrame{Offset: %d, Data length: %d, Offset + Data length: %d}", dir, f.Offset, dataLen, f.Offset+dataLen)
|
||||
case *StreamFrame:
|
||||
logger.Debugf("\t%s &wire.StreamFrame{StreamID: %d, FinBit: %t, Offset: %d, Data length: %d, Offset + Data length: %d}", dir, f.StreamID, f.FinBit, f.Offset, f.DataLen(), f.Offset+f.DataLen())
|
||||
logger.Debugf("\t%s &wire.StreamFrame{StreamID: %d, Fin: %t, Offset: %d, Data length: %d, Offset + Data length: %d}", dir, f.StreamID, f.Fin, f.Offset, f.DataLen(), f.Offset+f.DataLen())
|
||||
case *ResetStreamFrame:
|
||||
logger.Debugf("\t%s &wire.ResetStreamFrame{StreamID: %d, ErrorCode: %#x, FinalSize: %d}", dir, f.StreamID, f.ErrorCode, f.FinalSize)
|
||||
case *AckFrame:
|
||||
|
|
|
@ -63,7 +63,7 @@ var _ = Describe("Frame logging", func() {
|
|||
Data: bytes.Repeat([]byte{'f'}, 100),
|
||||
}
|
||||
LogFrame(logger, frame, false)
|
||||
Expect(buf.String()).To(ContainSubstring("\t<- &wire.StreamFrame{StreamID: 42, FinBit: false, Offset: 1337, Data length: 100, Offset + Data length: 1437}\n"))
|
||||
Expect(buf.String()).To(ContainSubstring("\t<- &wire.StreamFrame{StreamID: 42, Fin: false, Offset: 1337, Data length: 100, Offset + Data length: 1437}\n"))
|
||||
})
|
||||
|
||||
It("logs ACK frames without missing packets", func() {
|
||||
|
|
|
@ -15,7 +15,7 @@ type StreamFrame struct {
|
|||
StreamID protocol.StreamID
|
||||
Offset protocol.ByteCount
|
||||
Data []byte
|
||||
FinBit bool
|
||||
Fin bool
|
||||
DataLenPresent bool
|
||||
|
||||
fromPool bool
|
||||
|
@ -70,7 +70,7 @@ func parseStreamFrame(r *bytes.Reader, _ protocol.VersionNumber) (*StreamFrame,
|
|||
|
||||
frame.StreamID = protocol.StreamID(streamID)
|
||||
frame.Offset = protocol.ByteCount(offset)
|
||||
frame.FinBit = fin
|
||||
frame.Fin = fin
|
||||
frame.DataLenPresent = hasDataLen
|
||||
|
||||
if dataLen != 0 {
|
||||
|
@ -86,12 +86,12 @@ func parseStreamFrame(r *bytes.Reader, _ protocol.VersionNumber) (*StreamFrame,
|
|||
|
||||
// Write writes a STREAM frame
|
||||
func (f *StreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error {
|
||||
if len(f.Data) == 0 && !f.FinBit {
|
||||
if len(f.Data) == 0 && !f.Fin {
|
||||
return errors.New("StreamFrame: attempting to write empty frame without FIN")
|
||||
}
|
||||
|
||||
typeByte := byte(0x8)
|
||||
if f.FinBit {
|
||||
if f.Fin {
|
||||
typeByte ^= 0x1
|
||||
}
|
||||
hasOffset := f.Offset != 0
|
||||
|
@ -170,7 +170,7 @@ func (f *StreamFrame) MaybeSplitOffFrame(maxSize protocol.ByteCount, version pro
|
|||
new := GetStreamFrame()
|
||||
new.StreamID = f.StreamID
|
||||
new.Offset = f.Offset
|
||||
new.FinBit = false
|
||||
new.Fin = false
|
||||
new.DataLenPresent = f.DataLenPresent
|
||||
|
||||
// swap the data slices
|
||||
|
|
|
@ -22,7 +22,7 @@ var _ = Describe("STREAM frame", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.StreamID).To(Equal(protocol.StreamID(0x12345)))
|
||||
Expect(frame.Data).To(Equal([]byte("foobar")))
|
||||
Expect(frame.FinBit).To(BeFalse())
|
||||
Expect(frame.Fin).To(BeFalse())
|
||||
Expect(frame.Offset).To(Equal(protocol.ByteCount(0xdecafbad)))
|
||||
Expect(r.Len()).To(BeZero())
|
||||
})
|
||||
|
@ -37,7 +37,7 @@ var _ = Describe("STREAM frame", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.StreamID).To(Equal(protocol.StreamID(0x12345)))
|
||||
Expect(frame.Data).To(Equal([]byte("foob")))
|
||||
Expect(frame.FinBit).To(BeFalse())
|
||||
Expect(frame.Fin).To(BeFalse())
|
||||
Expect(frame.Offset).To(BeZero())
|
||||
Expect(r.Len()).To(Equal(2))
|
||||
})
|
||||
|
@ -51,7 +51,7 @@ var _ = Describe("STREAM frame", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.StreamID).To(Equal(protocol.StreamID(9)))
|
||||
Expect(frame.Data).To(Equal([]byte("foobar")))
|
||||
Expect(frame.FinBit).To(BeTrue())
|
||||
Expect(frame.Fin).To(BeTrue())
|
||||
Expect(frame.Offset).To(BeZero())
|
||||
Expect(r.Len()).To(BeZero())
|
||||
})
|
||||
|
@ -66,7 +66,7 @@ var _ = Describe("STREAM frame", func() {
|
|||
Expect(f.StreamID).To(Equal(protocol.StreamID(0x1337)))
|
||||
Expect(f.Offset).To(Equal(protocol.ByteCount(0x12345)))
|
||||
Expect(f.Data).To(BeEmpty())
|
||||
Expect(f.FinBit).To(BeFalse())
|
||||
Expect(f.Fin).To(BeFalse())
|
||||
})
|
||||
|
||||
It("rejects frames that overflow the maximum offset", func() {
|
||||
|
@ -115,7 +115,7 @@ var _ = Describe("STREAM frame", func() {
|
|||
Expect(frame.StreamID).To(Equal(protocol.StreamID(0x12345)))
|
||||
Expect(frame.Data).To(Equal(bytes.Repeat([]byte{'f'}, protocol.MinStreamFrameBufferSize)))
|
||||
Expect(frame.DataLen()).To(BeEquivalentTo(protocol.MinStreamFrameBufferSize))
|
||||
Expect(frame.FinBit).To(BeFalse())
|
||||
Expect(frame.Fin).To(BeFalse())
|
||||
Expect(frame.fromPool).To(BeTrue())
|
||||
Expect(r.Len()).To(BeZero())
|
||||
Expect(frame.PutBack).ToNot(Panic())
|
||||
|
@ -131,7 +131,7 @@ var _ = Describe("STREAM frame", func() {
|
|||
Expect(frame.StreamID).To(Equal(protocol.StreamID(0x12345)))
|
||||
Expect(frame.Data).To(Equal(bytes.Repeat([]byte{'f'}, protocol.MinStreamFrameBufferSize-1)))
|
||||
Expect(frame.DataLen()).To(BeEquivalentTo(protocol.MinStreamFrameBufferSize - 1))
|
||||
Expect(frame.FinBit).To(BeFalse())
|
||||
Expect(frame.Fin).To(BeFalse())
|
||||
Expect(frame.fromPool).To(BeFalse())
|
||||
Expect(r.Len()).To(BeZero())
|
||||
Expect(frame.PutBack).ToNot(Panic())
|
||||
|
@ -173,7 +173,7 @@ var _ = Describe("STREAM frame", func() {
|
|||
f := &StreamFrame{
|
||||
StreamID: 0x1337,
|
||||
Offset: 0x123456,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
}
|
||||
b := &bytes.Buffer{}
|
||||
err := f.Write(b, versionIETFFrames)
|
||||
|
@ -373,7 +373,7 @@ var _ = Describe("STREAM frame", func() {
|
|||
It("preserves the FIN bit", func() {
|
||||
f := &StreamFrame{
|
||||
StreamID: 0x1337,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
Offset: 0xdeadbeef,
|
||||
Data: make([]byte, 100),
|
||||
}
|
||||
|
@ -381,8 +381,8 @@ var _ = Describe("STREAM frame", func() {
|
|||
Expect(needsSplit).To(BeTrue())
|
||||
Expect(frame).ToNot(BeNil())
|
||||
Expect(frame.Offset).To(BeNumerically("<", f.Offset))
|
||||
Expect(f.FinBit).To(BeTrue())
|
||||
Expect(frame.FinBit).To(BeFalse())
|
||||
Expect(f.Fin).To(BeTrue())
|
||||
Expect(frame.Fin).To(BeFalse())
|
||||
})
|
||||
|
||||
It("produces frames of the correct length, without data len", func() {
|
||||
|
|
|
@ -566,7 +566,7 @@ var _ = Describe("Packet packer", func() {
|
|||
It("pads if payload length + packet number length is smaller than 4", func() {
|
||||
f := &wire.StreamFrame{
|
||||
StreamID: 0x10, // small stream ID, such that only a single byte is consumed
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
}
|
||||
Expect(f.Length(packer.version)).To(BeEquivalentTo(2))
|
||||
pnManager.EXPECT().PeekPacketNumber(protocol.Encryption1RTT).Return(protocol.PacketNumber(0x42), protocol.PacketNumberLen1)
|
||||
|
@ -599,7 +599,7 @@ var _ = Describe("Packet packer", func() {
|
|||
Expect(frame).To(BeAssignableToTypeOf(&wire.StreamFrame{}))
|
||||
sf := frame.(*wire.StreamFrame)
|
||||
Expect(sf.StreamID).To(Equal(f.StreamID))
|
||||
Expect(sf.FinBit).To(Equal(f.FinBit))
|
||||
Expect(sf.Fin).To(Equal(f.Fin))
|
||||
Expect(sf.Data).To(BeEmpty())
|
||||
Expect(r.Len()).To(BeZero())
|
||||
})
|
||||
|
|
|
@ -53,7 +53,7 @@ func transformFrame(wf wire.Frame) *frame {
|
|||
StreamID: f.StreamID,
|
||||
Offset: f.Offset,
|
||||
Length: f.DataLen(),
|
||||
FinBit: f.FinBit,
|
||||
FinBit: f.Fin,
|
||||
}}
|
||||
default:
|
||||
return &frame{Frame: wf}
|
||||
|
|
|
@ -143,7 +143,7 @@ var _ = Describe("Frames", func() {
|
|||
&wire.StreamFrame{
|
||||
StreamID: 42,
|
||||
Offset: 1337,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
Data: []byte("foobar"),
|
||||
},
|
||||
map[string]interface{}{
|
||||
|
|
|
@ -271,7 +271,7 @@ var _ = Describe("Tracer", func() {
|
|||
nil,
|
||||
[]wire.Frame{
|
||||
&wire.MaxStreamDataFrame{StreamID: 42, MaximumStreamData: 987},
|
||||
&wire.StreamFrame{StreamID: 123, Offset: 1234, Data: []byte("foobar"), FinBit: true},
|
||||
&wire.StreamFrame{StreamID: 123, Offset: 1234, Data: []byte("foobar"), Fin: true},
|
||||
},
|
||||
)
|
||||
entry := exportAndParseSingle()
|
||||
|
@ -328,7 +328,7 @@ var _ = Describe("Tracer", func() {
|
|||
789,
|
||||
[]wire.Frame{
|
||||
&wire.MaxStreamDataFrame{StreamID: 42, MaximumStreamData: 987},
|
||||
&wire.StreamFrame{StreamID: 123, Offset: 1234, Data: []byte("foobar"), FinBit: true},
|
||||
&wire.StreamFrame{StreamID: 123, Offset: 1234, Data: []byte("foobar"), Fin: true},
|
||||
},
|
||||
)
|
||||
entry := exportAndParseSingle()
|
||||
|
|
|
@ -41,7 +41,7 @@ type receiveStream struct {
|
|||
resetRemotelyErr StreamError
|
||||
|
||||
closedForShutdown bool // set when CloseForShutdown() is called
|
||||
finRead bool // set once we read a frame with a FinBit
|
||||
finRead bool // set once we read a frame with a Fin
|
||||
canceledRead bool // set when CancelRead() is called
|
||||
resetRemotely bool // set when HandleResetStreamFrame() is called
|
||||
|
||||
|
@ -234,11 +234,11 @@ func (s *receiveStream) handleStreamFrame(frame *wire.StreamFrame) error {
|
|||
|
||||
func (s *receiveStream) handleStreamFrameImpl(frame *wire.StreamFrame) (bool /* completed */, error) {
|
||||
maxOffset := frame.Offset + frame.DataLen()
|
||||
if err := s.flowController.UpdateHighestReceived(maxOffset, frame.FinBit); err != nil {
|
||||
if err := s.flowController.UpdateHighestReceived(maxOffset, frame.Fin); err != nil {
|
||||
return false, err
|
||||
}
|
||||
var newlyRcvdFinalOffset bool
|
||||
if frame.FinBit {
|
||||
if frame.Fin {
|
||||
newlyRcvdFinalOffset = s.finalOffset == protocol.MaxByteCount
|
||||
s.finalOffset = maxOffset
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ func (s *receiveStream) handleResetStreamFrameImpl(frame *wire.ResetStreamFrame)
|
|||
}
|
||||
|
||||
func (s *receiveStream) CloseRemote(offset protocol.ByteCount) {
|
||||
s.handleStreamFrame(&wire.StreamFrame{FinBit: true, Offset: offset})
|
||||
s.handleStreamFrame(&wire.StreamFrame{Fin: true, Offset: offset})
|
||||
}
|
||||
|
||||
func (s *receiveStream) SetReadDeadline(t time.Time) error {
|
||||
|
|
|
@ -332,7 +332,7 @@ var _ = Describe("Receive Stream", func() {
|
|||
str.handleStreamFrame(&wire.StreamFrame{
|
||||
Offset: 0,
|
||||
Data: []byte{0xDE, 0xAD, 0xBE, 0xEF},
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
})
|
||||
mockSender.EXPECT().onStreamCompleted(streamID)
|
||||
b := make([]byte, 4)
|
||||
|
@ -352,7 +352,7 @@ var _ = Describe("Receive Stream", func() {
|
|||
frame1 := wire.StreamFrame{
|
||||
Offset: 2,
|
||||
Data: []byte{0xBE, 0xEF},
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
}
|
||||
frame2 := wire.StreamFrame{
|
||||
Offset: 0,
|
||||
|
@ -379,7 +379,7 @@ var _ = Describe("Receive Stream", func() {
|
|||
err := str.handleStreamFrame(&wire.StreamFrame{
|
||||
Offset: 0,
|
||||
Data: []byte{0xde, 0xad},
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mockSender.EXPECT().onStreamCompleted(streamID)
|
||||
|
@ -395,7 +395,7 @@ var _ = Describe("Receive Stream", func() {
|
|||
mockFC.EXPECT().AddBytesRead(protocol.ByteCount(0))
|
||||
err := str.handleStreamFrame(&wire.StreamFrame{
|
||||
Offset: 0,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mockSender.EXPECT().onStreamCompleted(streamID)
|
||||
|
@ -492,7 +492,7 @@ var _ = Describe("Receive Stream", func() {
|
|||
Expect(str.handleStreamFrame(&wire.StreamFrame{
|
||||
StreamID: streamID,
|
||||
Data: []byte("foobar"),
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
})).To(Succeed())
|
||||
mockSender.EXPECT().onStreamCompleted(streamID)
|
||||
_, err := strWithTimeout.Read(make([]byte, 100))
|
||||
|
@ -517,7 +517,7 @@ var _ = Describe("Receive Stream", func() {
|
|||
mockFC.EXPECT().UpdateHighestReceived(protocol.ByteCount(1000), true)
|
||||
Expect(str.handleStreamFrame(&wire.StreamFrame{
|
||||
Offset: 1000,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
})).To(Succeed())
|
||||
mockFC.EXPECT().Abandon()
|
||||
mockSender.EXPECT().queueControlFrame(gomock.Any())
|
||||
|
@ -525,7 +525,7 @@ var _ = Describe("Receive Stream", func() {
|
|||
str.CancelRead(1234)
|
||||
})
|
||||
|
||||
It("completes the stream when receiving the FinBit after the stream was canceled", func() {
|
||||
It("completes the stream when receiving the Fin after the stream was canceled", func() {
|
||||
mockSender.EXPECT().queueControlFrame(gomock.Any())
|
||||
str.CancelRead(1234)
|
||||
gomock.InOrder(
|
||||
|
@ -535,7 +535,7 @@ var _ = Describe("Receive Stream", func() {
|
|||
mockSender.EXPECT().onStreamCompleted(streamID)
|
||||
Expect(str.handleStreamFrame(&wire.StreamFrame{
|
||||
Offset: 1000,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
})).To(Succeed())
|
||||
})
|
||||
|
||||
|
@ -550,11 +550,11 @@ var _ = Describe("Receive Stream", func() {
|
|||
mockSender.EXPECT().onStreamCompleted(streamID)
|
||||
Expect(str.handleStreamFrame(&wire.StreamFrame{
|
||||
Offset: 1000,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
})).To(Succeed())
|
||||
Expect(str.handleStreamFrame(&wire.StreamFrame{
|
||||
Offset: 1000,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
})).To(Succeed())
|
||||
})
|
||||
})
|
||||
|
@ -616,7 +616,7 @@ var _ = Describe("Receive Stream", func() {
|
|||
Expect(str.handleResetStreamFrame(rst)).To(Succeed())
|
||||
})
|
||||
|
||||
It("doesn't call onStreamCompleted again when the final offset was already received via FinBit", func() {
|
||||
It("doesn't call onStreamCompleted again when the final offset was already received via Fin", func() {
|
||||
mockSender.EXPECT().queueControlFrame(gomock.Any())
|
||||
str.CancelRead(1234)
|
||||
mockSender.EXPECT().onStreamCompleted(streamID)
|
||||
|
@ -625,7 +625,7 @@ var _ = Describe("Receive Stream", func() {
|
|||
Expect(str.handleStreamFrame(&wire.StreamFrame{
|
||||
StreamID: streamID,
|
||||
Offset: rst.FinalSize,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
})).To(Succeed())
|
||||
Expect(str.handleResetStreamFrame(rst)).To(Succeed())
|
||||
})
|
||||
|
|
|
@ -232,7 +232,7 @@ func (s *sendStream) popNewOrRetransmittedStreamFrame(maxBytes protocol.ByteCoun
|
|||
StreamID: s.streamID,
|
||||
Offset: s.writeOffset,
|
||||
DataLenPresent: true,
|
||||
FinBit: true,
|
||||
Fin: true,
|
||||
}, false
|
||||
}
|
||||
return nil, false
|
||||
|
@ -255,8 +255,8 @@ func (s *sendStream) popNewOrRetransmittedStreamFrame(maxBytes protocol.ByteCoun
|
|||
s.writeOffset += f.DataLen()
|
||||
s.flowController.AddBytesSent(f.DataLen())
|
||||
}
|
||||
f.FinBit = s.finishedWriting && s.dataForWriting == nil && s.nextFrame == nil && !s.finSent
|
||||
if f.FinBit {
|
||||
f.Fin = s.finishedWriting && s.dataForWriting == nil && s.nextFrame == nil && !s.finSent
|
||||
if f.Fin {
|
||||
s.finSent = true
|
||||
}
|
||||
return f, hasMoreData
|
||||
|
@ -283,14 +283,14 @@ func (s *sendStream) popNewStreamFrame(maxBytes, sendWindow protocol.ByteCount)
|
|||
}
|
||||
|
||||
f := wire.GetStreamFrame()
|
||||
f.FinBit = false
|
||||
f.Fin = false
|
||||
f.StreamID = s.streamID
|
||||
f.Offset = s.writeOffset
|
||||
f.DataLenPresent = true
|
||||
f.Data = f.Data[:0]
|
||||
|
||||
hasMoreData := s.popNewStreamFrameWithoutBuffer(f, maxBytes, sendWindow)
|
||||
if len(f.Data) == 0 && !f.FinBit {
|
||||
if len(f.Data) == 0 && !f.Fin {
|
||||
f.PutBack()
|
||||
return nil, hasMoreData
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ var _ = Describe("Send Stream", func() {
|
|||
frame, _ := str.popStreamFrame(protocol.MaxByteCount)
|
||||
f := frame.Frame.(*wire.StreamFrame)
|
||||
Expect(f.Data).To(Equal([]byte("foobar")))
|
||||
Expect(f.FinBit).To(BeFalse())
|
||||
Expect(f.Fin).To(BeFalse())
|
||||
Expect(f.Offset).To(BeZero())
|
||||
Expect(f.DataLenPresent).To(BeTrue())
|
||||
Expect(str.writeOffset).To(Equal(protocol.ByteCount(6)))
|
||||
|
@ -112,13 +112,13 @@ var _ = Describe("Send Stream", func() {
|
|||
frame, _ := str.popStreamFrame(expectedFrameHeaderLen(0) + 3)
|
||||
f := frame.Frame.(*wire.StreamFrame)
|
||||
Expect(f.Offset).To(BeZero())
|
||||
Expect(f.FinBit).To(BeFalse())
|
||||
Expect(f.Fin).To(BeFalse())
|
||||
Expect(f.Data).To(Equal([]byte("foo")))
|
||||
Expect(f.DataLenPresent).To(BeTrue())
|
||||
frame, _ = str.popStreamFrame(protocol.MaxByteCount)
|
||||
f = frame.Frame.(*wire.StreamFrame)
|
||||
Expect(f.Data).To(Equal([]byte("bar")))
|
||||
Expect(f.FinBit).To(BeFalse())
|
||||
Expect(f.Fin).To(BeFalse())
|
||||
Expect(f.Offset).To(Equal(protocol.ByteCount(3)))
|
||||
Expect(f.DataLenPresent).To(BeTrue())
|
||||
Expect(str.popStreamFrame(1000)).To(BeNil())
|
||||
|
@ -144,7 +144,7 @@ var _ = Describe("Send Stream", func() {
|
|||
frame, _ := str.popStreamFrame(protocol.MaxByteCount)
|
||||
f := frame.Frame.(*wire.StreamFrame)
|
||||
Expect(f.Offset).To(BeZero())
|
||||
Expect(f.FinBit).To(BeFalse())
|
||||
Expect(f.Fin).To(BeFalse())
|
||||
Expect(f.Data).To(Equal([]byte("foobar")))
|
||||
})
|
||||
|
||||
|
@ -166,7 +166,7 @@ var _ = Describe("Send Stream", func() {
|
|||
frame, _ := str.popStreamFrame(1100)
|
||||
f := frame.Frame.(*wire.StreamFrame)
|
||||
Expect(f.Offset).To(BeNumerically("~", 1100*i, 10*i))
|
||||
Expect(f.FinBit).To(BeFalse())
|
||||
Expect(f.Fin).To(BeFalse())
|
||||
Expect(f.Data).To(Equal(getDataAtOffset(f.Offset, f.DataLen())))
|
||||
Expect(f.DataLenPresent).To(BeTrue())
|
||||
}
|
||||
|
@ -248,11 +248,11 @@ var _ = Describe("Send Stream", func() {
|
|||
mockFC.EXPECT().AddBytesSent(gomock.Any()).Times(2)
|
||||
frame, hasMoreData := str.popStreamFrame(50)
|
||||
Expect(frame).ToNot(BeNil())
|
||||
Expect(frame.Frame.(*wire.StreamFrame).FinBit).To(BeFalse())
|
||||
Expect(frame.Frame.(*wire.StreamFrame).Fin).To(BeFalse())
|
||||
Expect(hasMoreData).To(BeTrue())
|
||||
frame, hasMoreData = str.popStreamFrame(protocol.MaxByteCount)
|
||||
Expect(frame).ToNot(BeNil())
|
||||
Expect(frame.Frame.(*wire.StreamFrame).FinBit).To(BeFalse())
|
||||
Expect(frame.Frame.(*wire.StreamFrame).Fin).To(BeFalse())
|
||||
Expect(hasMoreData).To(BeFalse())
|
||||
frame, _ = str.popStreamFrame(protocol.MaxByteCount)
|
||||
Expect(frame).To(BeNil())
|
||||
|
@ -533,7 +533,7 @@ var _ = Describe("Send Stream", func() {
|
|||
Expect(frame).ToNot(BeNil())
|
||||
f := frame.Frame.(*wire.StreamFrame)
|
||||
Expect(f.Data).To(BeEmpty())
|
||||
Expect(f.FinBit).To(BeTrue())
|
||||
Expect(f.Fin).To(BeTrue())
|
||||
Expect(f.DataLenPresent).To(BeTrue())
|
||||
Expect(hasMoreData).To(BeFalse())
|
||||
})
|
||||
|
@ -550,11 +550,11 @@ var _ = Describe("Send Stream", func() {
|
|||
Expect(frame).ToNot(BeNil())
|
||||
f := frame.Frame.(*wire.StreamFrame)
|
||||
Expect(f.Data).To(Equal([]byte("foo")))
|
||||
Expect(f.FinBit).To(BeFalse())
|
||||
Expect(f.Fin).To(BeFalse())
|
||||
frame, _ = str.popStreamFrame(protocol.MaxByteCount)
|
||||
f = frame.Frame.(*wire.StreamFrame)
|
||||
Expect(f.Data).To(Equal([]byte("bar")))
|
||||
Expect(f.FinBit).To(BeTrue())
|
||||
Expect(f.Fin).To(BeTrue())
|
||||
})
|
||||
|
||||
It("doesn't send a FIN when there's still data, for long writes", func() {
|
||||
|
@ -579,7 +579,7 @@ var _ = Describe("Send Stream", func() {
|
|||
Expect(frame).ToNot(BeNil())
|
||||
f := frame.Frame.(*wire.StreamFrame)
|
||||
Expect(f.Data).To(Equal(getDataAtOffset(f.Offset, f.DataLen())))
|
||||
Expect(f.FinBit).To(Equal(i == 5)) // the last frame should have the FIN bit set
|
||||
Expect(f.Fin).To(Equal(i == 5)) // the last frame should have the FIN bit set
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -602,7 +602,7 @@ var _ = Describe("Send Stream", func() {
|
|||
Expect(frame).ToNot(BeNil())
|
||||
f := frame.Frame.(*wire.StreamFrame)
|
||||
Expect(f.Data).To(BeEmpty())
|
||||
Expect(f.FinBit).To(BeTrue())
|
||||
Expect(f.Fin).To(BeTrue())
|
||||
frame, hasMoreData := str.popStreamFrame(1000)
|
||||
Expect(frame).To(BeNil())
|
||||
Expect(hasMoreData).To(BeFalse())
|
||||
|
@ -1035,7 +1035,7 @@ var _ = Describe("Send Stream", func() {
|
|||
frame, hasMoreData := str.popStreamFrame(protocol.MaxByteCount)
|
||||
Expect(hasMoreData).To(BeFalse())
|
||||
Expect(frame).ToNot(BeNil())
|
||||
Expect(frame.Frame.(*wire.StreamFrame).FinBit).To(BeTrue())
|
||||
Expect(frame.Frame.(*wire.StreamFrame).Fin).To(BeTrue())
|
||||
|
||||
mockSender.EXPECT().onStreamCompleted(streamID)
|
||||
frame.OnAcked(frame.Frame)
|
||||
|
@ -1062,7 +1062,7 @@ var _ = Describe("Send Stream", func() {
|
|||
continue
|
||||
}
|
||||
frames = append(frames, *frame)
|
||||
if frame.Frame.(*wire.StreamFrame).FinBit {
|
||||
if frame.Frame.(*wire.StreamFrame).Fin {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue