pass the version to the receiveStream constructor

This commit is contained in:
Marten Seemann 2018-02-02 14:55:22 +08:00
parent d0a394430f
commit 5d45bb046b
3 changed files with 9 additions and 3 deletions

View file

@ -55,6 +55,7 @@ func newReceiveStream(
streamID protocol.StreamID,
sender streamSender,
flowController flowcontrol.StreamFlowController,
version protocol.VersionNumber,
) *receiveStream {
return &receiveStream{
streamID: streamID,
@ -62,6 +63,7 @@ func newReceiveStream(
flowController: flowController,
frameQueue: newStreamFrameSorter(),
readChan: make(chan struct{}, 1),
version: version,
}
}

View file

@ -29,7 +29,7 @@ var _ = Describe("Receive Stream", func() {
BeforeEach(func() {
mockSender = NewMockStreamSender(mockCtrl)
mockFC = mocks.NewMockStreamFlowController(mockCtrl)
str = newReceiveStream(streamID, mockSender, mockFC)
str = newReceiveStream(streamID, mockSender, mockFC, versionIETFFrames)
timeout := scaleDuration(250 * time.Millisecond)
strWithTimeout = gbytes.TimeoutReader(str, timeout)
@ -494,6 +494,7 @@ var _ = Describe("Receive Stream", func() {
})
It("queues a STOP_SENDING frame, for IETF QUIC", func() {
str.version = versionIETFFrames
mockSender.EXPECT().queueControlFrame(&wire.StopSendingFrame{
StreamID: streamID,
ErrorCode: 1234,
@ -503,7 +504,10 @@ var _ = Describe("Receive Stream", func() {
})
It("doesn't queue a STOP_SENDING frame, for gQUIC", func() {
str.version = versionGQUICFrames
// no calls to mockSender.queueControlFrame
err := str.CancelRead(1234)
Expect(err).ToNot(HaveOccurred())
})
})

View file

@ -125,7 +125,7 @@ func newStream(streamID protocol.StreamID,
s.completedMutex.Unlock()
},
}
s.receiveStream = *newReceiveStream(streamID, senderForReceiveStream, flowController)
s.receiveStream = *newReceiveStream(streamID, senderForReceiveStream, flowController, version)
return s
}