diff --git a/stream_frame_sorter.go b/stream_frame_sorter.go index e0d8c4a6..7a95f1f1 100644 --- a/stream_frame_sorter.go +++ b/stream_frame_sorter.go @@ -16,7 +16,6 @@ type streamFrameSorter struct { } var ( - errOverlappingStreamData = qerr.Error(qerr.OverlappingStreamData, "") errTooManyGapsInReceivedStreamData = errors.New("Too many gaps in received StreamFrame data") errDuplicateStreamData = errors.New("Overlapping Stream Data") errEmptyStreamData = errors.New("Stream Data empty") @@ -57,11 +56,11 @@ func (s *streamFrameSorter) Push(frame *frames.StreamFrame) error { } if start < gap.Value.Start { - return errOverlappingStreamData + return qerr.Error(qerr.OverlappingStreamData, "start of gap in stream chunk") } if start < gap.Value.End && end > gap.Value.End { - return errOverlappingStreamData + return qerr.Error(qerr.OverlappingStreamData, "end of gap in stream chunk") } foundInGap = true diff --git a/stream_frame_sorter_test.go b/stream_frame_sorter_test.go index f8c40f72..ebdbdf95 100644 --- a/stream_frame_sorter_test.go +++ b/stream_frame_sorter_test.go @@ -3,7 +3,6 @@ package quic import ( "github.com/lucas-clemente/quic-go/frames" "github.com/lucas-clemente/quic-go/protocol" - "github.com/lucas-clemente/quic-go/qerr" "github.com/lucas-clemente/quic-go/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -264,7 +263,7 @@ var _ = Describe("StreamFrame sorter", func() { Data: []byte("foobar"), } err := s.Push(f) - Expect(err).To(MatchError(qerr.Error(qerr.OverlappingStreamData, ""))) + Expect(err).To(MatchError("OverlappingStreamData: end of gap in stream chunk")) Expect(s.queuedFrames).ToNot(HaveKey(protocol.ByteCount(0))) compareGapValues(s.gaps, expectedGaps) }) @@ -276,7 +275,7 @@ var _ = Describe("StreamFrame sorter", func() { Data: []byte("12"), } err := s.Push(f) - Expect(err).To(MatchError(errOverlappingStreamData)) + Expect(err).To(MatchError("OverlappingStreamData: end of gap in stream chunk")) Expect(s.queuedFrames).ToNot(HaveKey(protocol.ByteCount(4))) compareGapValues(s.gaps, expectedGaps) }) @@ -288,7 +287,7 @@ var _ = Describe("StreamFrame sorter", func() { Data: []byte("foobar"), } err := s.Push(f) - Expect(err).To(MatchError(errOverlappingStreamData)) + Expect(err).To(MatchError("OverlappingStreamData: end of gap in stream chunk")) Expect(s.queuedFrames).ToNot(HaveKey(protocol.ByteCount(10))) compareGapValues(s.gaps, expectedGaps) }) @@ -300,7 +299,7 @@ var _ = Describe("StreamFrame sorter", func() { Data: []byte("foobar"), } err := s.Push(f) - Expect(err).To(MatchError(errOverlappingStreamData)) + Expect(err).To(MatchError("OverlappingStreamData: start of gap in stream chunk")) Expect(s.queuedFrames).ToNot(HaveKey(protocol.ByteCount(8))) compareGapValues(s.gaps, expectedGaps) }) @@ -312,7 +311,7 @@ var _ = Describe("StreamFrame sorter", func() { Data: []byte("123456789"), } err := s.Push(f) - Expect(err).To(MatchError(errOverlappingStreamData)) + Expect(err).To(MatchError("OverlappingStreamData: end of gap in stream chunk")) Expect(s.queuedFrames).ToNot(HaveKey(protocol.ByteCount(2))) compareGapValues(s.gaps, expectedGaps) }) @@ -324,7 +323,7 @@ var _ = Describe("StreamFrame sorter", func() { Data: []byte("123456789"), } err := s.Push(f) - Expect(err).To(MatchError(errOverlappingStreamData)) + Expect(err).To(MatchError("OverlappingStreamData: start of gap in stream chunk")) Expect(s.queuedFrames).ToNot(HaveKey(protocol.ByteCount(8))) compareGapValues(s.gaps, expectedGaps) }) @@ -336,7 +335,7 @@ var _ = Describe("StreamFrame sorter", func() { Data: []byte("1234567890"), } err := s.Push(f) - Expect(err).To(MatchError(errOverlappingStreamData)) + Expect(err).To(MatchError("OverlappingStreamData: end of gap in stream chunk")) Expect(s.queuedFrames).ToNot(HaveKey(protocol.ByteCount(10))) compareGapValues(s.gaps, expectedGaps) }) diff --git a/stream_test.go b/stream_test.go index e83388b5..2e4f5a69 100644 --- a/stream_test.go +++ b/stream_test.go @@ -285,7 +285,7 @@ var _ = Describe("Stream", func() { err := str.AddStreamFrame(&frame1) Expect(err).ToNot(HaveOccurred()) err = str.AddStreamFrame(&frame2) - Expect(err).To(MatchError(errOverlappingStreamData)) + Expect(err).To(MatchError("OverlappingStreamData: start of gap in stream chunk")) }) It("calls onData", func() {