diff options
Diffstat (limited to 'xdelta3/go/src/xdelta/rstream.go')
-rw-r--r-- | xdelta3/go/src/xdelta/rstream.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/xdelta3/go/src/xdelta/rstream.go b/xdelta3/go/src/xdelta/rstream.go index 1d56031..3e7265f 100644 --- a/xdelta3/go/src/xdelta/rstream.go +++ b/xdelta3/go/src/xdelta/rstream.go | |||
@@ -7,16 +7,17 @@ import ( | |||
7 | ) | 7 | ) |
8 | 8 | ||
9 | const ( | 9 | const ( |
10 | blocksize = 16380 // A factor of 7 | 10 | blocksize = 16380 |
11 | ) | 11 | ) |
12 | 12 | ||
13 | func WriteRstreams(seed, offset, len int64, | 13 | func WriteRstreams(t *TestGroup, seed, offset, len int64, |
14 | first, second io.WriteCloser) { | 14 | first, second io.WriteCloser) { |
15 | go writeOne(seed, 0, len, first) | 15 | go writeOne(t, seed, 0, len, first) |
16 | go writeOne(seed, offset, len, second) | 16 | go writeOne(t, seed, offset, len, second) |
17 | } | 17 | } |
18 | 18 | ||
19 | func writeOne(seed, offset, len int64, stream io.WriteCloser) error { | 19 | func writeOne(t *TestGroup, seed, offset, len int64, stream io.WriteCloser) error { |
20 | t.WaitGroup.Add(1) | ||
20 | if offset != 0 { | 21 | if offset != 0 { |
21 | // Fill with other random data until the offset | 22 | // Fill with other random data until the offset |
22 | if err := writeRand(rand.New(rand.NewSource(^seed)), offset, stream); err != nil { | 23 | if err := writeRand(rand.New(rand.NewSource(^seed)), offset, stream); err != nil { |
@@ -27,6 +28,7 @@ func writeOne(seed, offset, len int64, stream io.WriteCloser) error { | |||
27 | len - offset, stream); err != nil { | 28 | len - offset, stream); err != nil { |
28 | return err | 29 | return err |
29 | } | 30 | } |
31 | t.WaitGroup.Done() | ||
30 | return stream.Close() | 32 | return stream.Close() |
31 | } | 33 | } |
32 | 34 | ||