Skip to content

Commit

Permalink
doom
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleSanderson authored Feb 3, 2025
1 parent 9d01640 commit a279372
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions internal/torrent/hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,14 @@ func (h *pieceHasher) runPieceWorkers() int {
workers := h.optimizeForWorkload()

// create channel before starting goroutines
ch := make(chan workHashUnit, workers*4)
h.ch = ch // atomic assignment

h.ch := make(chan workHashUnit, workers*4)

Check failure on line 146 in internal/torrent/hasher.go

View workflow job for this annotation

GitHub Actions / Test on ubuntu-latest

non-name h.ch on left side of :=

Check failure on line 146 in internal/torrent/hasher.go

View workflow job for this annotation

GitHub Actions / Test on macos-latest

non-name h.ch on left side of :=
for i := 0; i < workers; i++ {
go func() {
go func(ch <-chan workHashUnit) {
for w := range ch { // use local ch instead of h.ch
h.hashPiece(w)
h.wg.Done()
}
}()
}(h.ch)
}

return workers
Expand Down

0 comments on commit a279372

Please sign in to comment.