aboutsummaryrefslogtreecommitdiff
path: root/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'repo.go')
-rw-r--r--repo.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/repo.go b/repo.go
index 457dadd..cfb5580 100644
--- a/repo.go
+++ b/repo.go
@@ -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
}