good morning!!!!

Skip to content
Snippets Groups Projects
Commit eb2f01ae authored by Daniel A. Nagy's avatar Daniel A. Nagy
Browse files

swarm/storage: Allow EOF at the end of the reader in the chunker. Handle the...

swarm/storage: Allow EOF at the end of the reader in the chunker. Handle the case when Read returns less than length of target slice
parent a45421ba
No related branches found
No related tags found
No related merge requests found
......@@ -178,10 +178,14 @@ func (self *TreeChunker) split(depth int, treeSize int64, key Key, data io.Reade
// leaf nodes -> content chunks
chunkData := make([]byte, size+8)
binary.LittleEndian.PutUint64(chunkData[0:8], uint64(size))
_, err := data.Read(chunkData[8:])
if err != nil {
errC <- err
return
var readBytes int64
for readBytes < size {
n, err := data.Read(chunkData[8+readBytes:])
readBytes += int64(n)
if err != nil && !(err == io.EOF && readBytes == size) {
errC <- err
return
}
}
select {
case jobC <- &hashJob{key, chunkData, size, parentWg}:
......@@ -371,7 +375,6 @@ func (self *LazyChunkReader) join(b []byte, off int64, eoff int64, depth int, tr
defer parentWg.Done()
// return NewDPA(&LocalStore{})
// chunk.Size = int64(binary.LittleEndian.Uint64(chunk.SData[0:8]))
// find appropriate block level
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment