You've already forked torrent-client
mirror of
https://github.com/veggiedefender/torrent-client.git
synced 2025-11-06 09:29:16 +02:00
Fix race condition
The download loop might finish and kill the worker goroutine before it's done sending HAVE messages. Switching the order of these two lines trivially fixes the issue (but it's still brittle)
This commit is contained in:
@@ -173,8 +173,8 @@ func (t *Torrent) startDownloadWorker(peer peers.Peer, workQueue chan *pieceWork
|
||||
continue
|
||||
}
|
||||
|
||||
results <- &pieceResult{pw.index, buf}
|
||||
c.have(pw.index)
|
||||
results <- &pieceResult{pw.index, buf}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user