diff options
Diffstat (limited to 'repo.go')
-rw-r--r-- | repo.go | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -296,8 +296,12 @@ func (r *Repo) matchStream(stream io.Reader, fingerprints FingerprintMap) []Chun buff = make([]byte, 0, chunkSize) for i := 0; i < chunkSize && err == nil; i++ { b, err = bufStream.ReadByte() + buff = append(buff, b) hasher.Roll(b) } + if err == nil { + buff = make([]byte, 0, chunkSize) + } continue } if len(buff) == chunkSize { @@ -312,7 +316,8 @@ func (r *Repo) matchStream(stream io.Reader, fingerprints FingerprintMap) []Chun } } if len(buff) > 0 { - chunks = append(chunks, NewTempChunk(buff)) + log.Printf("Add new partial chunk of size: %d\n", len(buff)) + chunks = append(chunks, NewTempChunk(buff[:chunkSize])) } return chunks } |