mirror of
https://github.com/octoleo/restic.git
synced 2025-01-30 18:38:49 +00:00
Fix reusing chunker
This commit is contained in:
parent
4b6c7f1584
commit
9dc0bf6378
@ -90,6 +90,7 @@ func (c *Chunker) reset() {
|
||||
for i := 0; i < WindowSize; i++ {
|
||||
c.window[i] = 0
|
||||
}
|
||||
c.closed = false
|
||||
c.digest = 0
|
||||
c.wpos = 0
|
||||
c.pos = 0
|
||||
|
@ -126,6 +126,16 @@ func TestChunker(t *testing.T) {
|
||||
ch.Free()
|
||||
}
|
||||
|
||||
func TestChunkerReuse(t *testing.T) {
|
||||
// test multiple uses of the same chunker
|
||||
for i := 0; i < 4; i++ {
|
||||
buf := get_random(23, 32*1024*1024)
|
||||
ch := chunker.New(bytes.NewReader(buf))
|
||||
test_with_data(t, ch, chunks1)
|
||||
ch.Free()
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkChunker(b *testing.B) {
|
||||
size := 10 * 1024 * 1024
|
||||
buf := get_random(23, size)
|
||||
|
Loading…
x
Reference in New Issue
Block a user