Skip to content

Commit

Permalink
Get LimitReader from pool in parseAllFrames
Browse files Browse the repository at this point in the history
  • Loading branch information
n10v committed May 1, 2017
1 parent be61a02 commit f74418d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ func (t *Tag) parseAllFrames() error {
}

framesSize := t.originalSize - tagHeaderSize
fileReader := io.LimitReader(t.file, framesSize)
fileReader := lrpool.Get()
defer lrpool.Put(fileReader)
fileReader.R = t.file
fileReader.N = framesSize

for {
id, frame, err := parseFrame(fileReader)
Expand Down

0 comments on commit f74418d

Please sign in to comment.