Skip to content

Commit

Permalink
fix(hash): 修复并发计算错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-lht committed Apr 29, 2023
1 parent 8a8c360 commit add3e4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func (r *FileHash) Hash(h hash.Hash) (s string, err error) {
if _, err = r.File.Seek(0, 0); err != nil {
return
}
h.Reset()
r.ProgressRecorder.Reset()
if _, err = r.copyBuffer(h, r.File, buf); err != nil {
if err == errStop {
Expand Down
4 changes: 2 additions & 2 deletions cmd/unitmainImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ showResult:
info.WriteString(fmt.Sprintf("%s: %s\r\n", hashAlg.Name, s))
}
}
info.WriteString(fmt.Sprintf("总耗时: %s\r\n", time.Since(t)))
info.WriteString(fmt.Sprintf("平均速度: %s/s\r\n", humanize.IBytes(uint64(float64(fileInfo.Size())/time.Since(t).Seconds()))))
info.WriteString(fmt.Sprintf("耗时: %s\r\n", time.Since(t)))
info.WriteString(fmt.Sprintf("速度: %s/s\r\n", humanize.IBytes(uint64(float64(fileInfo.Size())/time.Since(t).Seconds()))))
f.MemoLogger.Lines().Add(info.String())
}

0 comments on commit add3e4d

Please # to comment.