This commit is contained in:
Wenbiao Zheng 2018-06-19 11:59:46 +00:00 committed by GitHub
commit af55be568a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -184,8 +184,6 @@ func (self *TreeChunker) Split(data io.Reader, size int64, chunkC chan *Chunk, s
func (self *TreeChunker) split(depth int, treeSize int64, key Key, data io.Reader, size int64, jobC chan *hashJob, chunkC chan *Chunk, errC chan error, quitC chan bool, parentWg, swg, wwg *sync.WaitGroup) {
//
for depth > 0 && size < treeSize {
treeSize /= self.branches
depth--
@ -482,7 +480,6 @@ func retrieve(key Key, chunkC chan *Chunk, quitC chan bool) *Chunk {
}
// waiting for the chunk retrieval
select { // chunk.Size = int64(binary.LittleEndian.Uint64(chunk.SData[0:8]))
case <-quitC:
// this is how we control process leakage (quitC is closed once join is finished (after timeout))
return nil

View file

@ -113,7 +113,9 @@ func (self *chunkerTester) Append(chunker Splitter, rootKey Key, data io.Reader,
// getting data
chunk.SData = stored.SData
chunk.Size = int64(binary.LittleEndian.Uint64(chunk.SData[0:8]))
close(chunk.C)
if c := chunk.C; c != nil {
close(c)
}
}
}
}
@ -159,7 +161,9 @@ func (self *chunkerTester) Join(chunker Chunker, key Key, c int, chunkC chan *Ch
}
chunk.SData = stored.SData
chunk.Size = int64(binary.LittleEndian.Uint64(chunk.SData[0:8]))
close(chunk.C)
if c := chunk.C; c != nil {
close(c)
}
i++
}
}