mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-16 17:03:46 +00:00
Merge f809fa5941 into 73067fd24f
This commit is contained in:
commit
3bc264f8a0
1 changed files with 5 additions and 3 deletions
|
|
@ -43,11 +43,14 @@ type chunkerTester struct {
|
|||
inputs map[uint64][]byte
|
||||
chunks map[string]*Chunk
|
||||
t test
|
||||
lock sync.Mutex
|
||||
}
|
||||
|
||||
func (self *chunkerTester) Split(chunker Splitter, data io.Reader, size int64, chunkC chan *Chunk, swg *sync.WaitGroup, expectedError error) (key Key, err error) {
|
||||
// reset
|
||||
self.lock.Lock()
|
||||
self.chunks = make(map[string]*Chunk)
|
||||
self.lock.Unlock()
|
||||
|
||||
if self.inputs == nil {
|
||||
self.inputs = make(map[uint64][]byte)
|
||||
|
|
@ -65,7 +68,9 @@ func (self *chunkerTester) Split(chunker Splitter, data io.Reader, size int64, c
|
|||
return nil
|
||||
case chunk := <-chunkC:
|
||||
// self.chunks = append(self.chunks, chunk)
|
||||
self.lock.Lock()
|
||||
self.chunks[chunk.Key.String()] = chunk
|
||||
self.lock.Unlock()
|
||||
if chunk.wg != nil {
|
||||
chunk.wg.Done()
|
||||
}
|
||||
|
|
@ -81,9 +86,6 @@ func (self *chunkerTester) Split(chunker Splitter, data io.Reader, size int64, c
|
|||
}
|
||||
|
||||
if chunkC != nil {
|
||||
if swg != nil {
|
||||
swg.Wait()
|
||||
}
|
||||
close(quitC)
|
||||
}
|
||||
return key, err
|
||||
|
|
|
|||
Loading…
Reference in a new issue