Skip to content

Commit

Permalink
Update hasher.go
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleSanderson authored Feb 2, 2025
1 parent 81c9537 commit a7e84e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/torrent/hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (h *pieceHasher) optimizeForWorkload() (int) {
case avgFileSize < 10<<20:
numWorkers = int(min(int64(4), int64(runtime.NumCPU())))
default:
vnumWorkers = int(min(int64(2), int64(runtime.NumCPU())))
numWorkers = int(min(int64(2), int64(runtime.NumCPU())))
}

// ensure we don't create more workers than pieces to process
Expand Down Expand Up @@ -134,7 +134,7 @@ func (h *pieceHasher) hashFiles() error {
fileSize := int64(h.files[i].length)
for {
toRead := min(h.pieceLen - lastRead, fileSize - read)
if _, err := io.CopyN(*hasher, r, toRead); err != nil {
if _, err := io.CopyN(hasher, r, toRead); err != nil {
if err == io.EOF {
break
}
Expand Down

0 comments on commit a7e84e8

Please sign in to comment.