Skip to content

Commit

Permalink
use local var to avoid race on close
Browse files Browse the repository at this point in the history
  • Loading branch information
mh0lt committed Aug 3, 2024
1 parent 57210f4 commit 08b20c6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions torrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2887,8 +2887,10 @@ func (t *Torrent) processHashResults(hashResults chan hashResult) {

for done := false; !done; {
select {
case result := <-hashResults:
results = append(results, result)
case result, ok := <-hashResults:
if ok {
results = append(results, result)
}
default:
done = true
}
Expand Down

0 comments on commit 08b20c6

Please sign in to comment.