From 5a00fd89f6ad3f899e7c5e2dca1865c3f16f8ec9 Mon Sep 17 00:00:00 2001 From: Lucas Clemente Date: Tue, 2 Aug 2016 11:34:12 +0200 Subject: [PATCH] simplify stream now that the frame sorter handles gaps properly --- stream.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/stream.go b/stream.go index bd5e778a6..afea1a26a 100644 --- a/stream.go +++ b/stream.go @@ -85,19 +85,8 @@ func (s *stream) Read(p []byte) (int, error) { break } if frame != nil { - // Pop and continue if the frame doesn't have any new data - if frame.Offset+frame.DataLen() <= s.readOffset && !frame.FinBit { - s.frameQueue.Pop() - frame = s.frameQueue.Head() - continue - } - // If the frame's offset is <= our current read pos, and we didn't - // go into the previous if, we can read data from the frame. - if frame.Offset <= s.readOffset { - // Set our read position in the frame properly - s.readPosInFrame = int(s.readOffset - frame.Offset) - break - } + s.readPosInFrame = int(s.readOffset - frame.Offset) + break } s.newFrameOrErrCond.Wait() frame = s.frameQueue.Head()