From 08b20c6d46d90ff2508234bf38466035c995e1bd Mon Sep 17 00:00:00 2001 From: Mark Holt Date: Sat, 3 Aug 2024 13:36:17 +0100 Subject: [PATCH] use local var to avoid race on close --- torrent.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/torrent.go b/torrent.go index 412235da6f..48c7fab6a0 100644 --- a/torrent.go +++ b/torrent.go @@ -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 }