drop support for gQUIC

This commit is contained in:
Marten Seemann 2018-10-24 09:34:44 +07:00
parent 8f8ed03254
commit 3266e36811
195 changed files with 2638 additions and 35430 deletions

View file

@ -55,118 +55,6 @@ var _ = Describe("Stream", func() {
Expect(str.StreamID()).To(Equal(protocol.StreamID(1337)))
})
// need some stream cancelation tests here, since gQUIC doesn't cleanly separate the two stream halves
Context("stream cancelations", func() {
Context("for gQUIC", func() {
BeforeEach(func() {
str.version = versionGQUICFrames
str.receiveStream.version = versionGQUICFrames
str.sendStream.version = versionGQUICFrames
})
It("unblocks Write when receiving a RST_STREAM frame with non-zero error code", func() {
mockSender.EXPECT().onHasStreamData(streamID)
mockSender.EXPECT().queueControlFrame(&wire.RstStreamFrame{
StreamID: streamID,
ByteOffset: 1000,
ErrorCode: errorCodeStoppingGQUIC,
})
mockSender.EXPECT().onStreamCompleted(streamID)
mockFC.EXPECT().UpdateHighestReceived(protocol.ByteCount(6), true)
str.writeOffset = 1000
f := &wire.RstStreamFrame{
StreamID: streamID,
ByteOffset: 6,
ErrorCode: 123,
}
writeReturned := make(chan struct{})
go func() {
defer GinkgoRecover()
_, err := strWithTimeout.Write([]byte("foobar"))
Expect(err).To(MatchError("Stream 1337 was reset with error code 123"))
Expect(err).To(BeAssignableToTypeOf(streamCanceledError{}))
Expect(err.(streamCanceledError).Canceled()).To(BeTrue())
Expect(err.(streamCanceledError).ErrorCode()).To(Equal(protocol.ApplicationErrorCode(123)))
close(writeReturned)
}()
Consistently(writeReturned).ShouldNot(BeClosed())
err := str.handleRstStreamFrame(f)
Expect(err).ToNot(HaveOccurred())
Eventually(writeReturned).Should(BeClosed())
})
It("unblocks Write when receiving a RST_STREAM frame with error code 0", func() {
mockSender.EXPECT().onHasStreamData(streamID)
mockSender.EXPECT().queueControlFrame(&wire.RstStreamFrame{
StreamID: streamID,
ByteOffset: 1000,
ErrorCode: errorCodeStoppingGQUIC,
})
mockFC.EXPECT().UpdateHighestReceived(protocol.ByteCount(6), true)
str.writeOffset = 1000
f := &wire.RstStreamFrame{
StreamID: streamID,
ByteOffset: 6,
ErrorCode: 0,
}
writeReturned := make(chan struct{})
go func() {
defer GinkgoRecover()
_, err := strWithTimeout.Write([]byte("foobar"))
Expect(err).To(MatchError("Stream 1337 was reset with error code 0"))
Expect(err).To(BeAssignableToTypeOf(streamCanceledError{}))
Expect(err.(streamCanceledError).Canceled()).To(BeTrue())
Expect(err.(streamCanceledError).ErrorCode()).To(Equal(protocol.ApplicationErrorCode(0)))
close(writeReturned)
}()
Consistently(writeReturned).ShouldNot(BeClosed())
err := str.handleRstStreamFrame(f)
Expect(err).ToNot(HaveOccurred())
Eventually(writeReturned).Should(BeClosed())
})
It("sends a RST_STREAM with error code 0, after the stream is closed", func() {
str.version = versionGQUICFrames
mockSender.EXPECT().onHasStreamData(streamID).Times(2) // once for the Write, once for the Close
mockFC.EXPECT().SendWindowSize().Return(protocol.MaxByteCount).AnyTimes()
mockFC.EXPECT().AddBytesSent(protocol.ByteCount(6))
err := str.CancelRead(1234)
Expect(err).ToNot(HaveOccurred())
writeReturned := make(chan struct{})
go func() {
defer GinkgoRecover()
_, err := strWithTimeout.Write([]byte("foobar"))
Expect(err).ToNot(HaveOccurred())
close(writeReturned)
}()
Eventually(func() *wire.StreamFrame {
frame, _ := str.popStreamFrame(1000)
return frame
}).ShouldNot(BeNil())
Eventually(writeReturned).Should(BeClosed())
mockSender.EXPECT().queueControlFrame(&wire.RstStreamFrame{
StreamID: streamID,
ByteOffset: 6,
ErrorCode: 0,
})
Expect(str.Close()).To(Succeed())
})
})
Context("for IETF QUIC", func() {
It("doesn't queue a RST_STREAM after closing the stream", func() { // this is what it does for gQUIC
mockSender.EXPECT().queueControlFrame(&wire.StopSendingFrame{
StreamID: streamID,
ErrorCode: 1234,
})
mockSender.EXPECT().onHasStreamData(streamID)
err := str.CancelRead(1234)
Expect(err).ToNot(HaveOccurred())
Expect(str.Close()).To(Succeed())
})
})
})
Context("deadlines", func() {
It("sets a write deadline, when SetDeadline is called", func() {
str.SetDeadline(time.Now().Add(-time.Second))