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