This reverts commit 6d3f9d5154.
This commit is contained in:
@@ -65,15 +65,15 @@ type parallelHasher struct {
|
||||
fs fs.Filesystem
|
||||
blockSize int
|
||||
workers int
|
||||
outbox chan<- ScanResult
|
||||
inbox <-chan ScanResult
|
||||
outbox chan<- protocol.FileInfo
|
||||
inbox <-chan protocol.FileInfo
|
||||
counter Counter
|
||||
done chan<- struct{}
|
||||
useWeakHashes bool
|
||||
wg sync.WaitGroup
|
||||
}
|
||||
|
||||
func newParallelHasher(ctx context.Context, fs fs.Filesystem, blockSize, workers int, outbox chan<- ScanResult, inbox <-chan ScanResult, counter Counter, done chan<- struct{}, useWeakHashes bool) {
|
||||
func newParallelHasher(ctx context.Context, fs fs.Filesystem, blockSize, workers int, outbox chan<- protocol.FileInfo, inbox <-chan protocol.FileInfo, counter Counter, done chan<- struct{}, useWeakHashes bool) {
|
||||
ph := ¶llelHasher{
|
||||
fs: fs,
|
||||
blockSize: blockSize,
|
||||
@@ -104,25 +104,25 @@ func (ph *parallelHasher) hashFiles(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if f.New.IsDirectory() || f.New.IsDeleted() {
|
||||
if f.IsDirectory() || f.IsDeleted() {
|
||||
panic("Bug. Asked to hash a directory or a deleted file.")
|
||||
}
|
||||
|
||||
blocks, err := HashFile(ctx, ph.fs, f.New.Name, ph.blockSize, ph.counter, ph.useWeakHashes)
|
||||
blocks, err := HashFile(ctx, ph.fs, f.Name, ph.blockSize, ph.counter, ph.useWeakHashes)
|
||||
if err != nil {
|
||||
l.Debugln("hash error:", f.New.Name, err)
|
||||
l.Debugln("hash error:", f.Name, err)
|
||||
continue
|
||||
}
|
||||
|
||||
f.New.Blocks = blocks
|
||||
f.Blocks = blocks
|
||||
|
||||
// The size we saw when initially deciding to hash the file
|
||||
// might not have been the size it actually had when we hashed
|
||||
// it. Update the size from the block list.
|
||||
|
||||
f.New.Size = 0
|
||||
f.Size = 0
|
||||
for _, b := range blocks {
|
||||
f.New.Size += int64(b.Size)
|
||||
f.Size += int64(b.Size)
|
||||
}
|
||||
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user