This commit is contained in:
techknowlogick 2021-02-28 18:08:33 -05:00 committed by GitHub
parent 030646eea4
commit 47f6a4ec3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
947 changed files with 26119 additions and 7062 deletions

View file

@ -67,8 +67,9 @@ func (b *Blocks) close(f *Frame, num int) error {
return err
}
if b.Blocks == nil {
// Not initialized yet.
return nil
err := b.err
b.err = nil
return err
}
c := make(chan *FrameDataBlock)
b.Blocks <- c
@ -114,15 +115,18 @@ func (b *Blocks) initR(f *Frame, num int, src io.Reader) (chan []byte, error) {
block := NewFrameDataBlock(f)
cumx, err = block.Read(f, src, 0)
if err != nil {
block.Close(f)
break
}
// Recheck for an error as reading may be slow and uncompressing is expensive.
if b.ErrorR() != nil {
block.Close(f)
break
}
c := make(chan []byte)
blocks <- c
go func() {
defer block.Close(f)
data, err := block.Uncompress(f, size.Get(), false)
if err != nil {
b.closeR(err)