]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix a race where the last piece of a torrent is requested before it's been hashed
authorMatt Joiner <anacrolix@gmail.com>
Sun, 29 Jun 2014 09:08:16 +0000 (19:08 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 29 Jun 2014 09:08:16 +0000 (19:08 +1000)
client.go

index eb352290bbdbd63525e520ef44bb6d6032f9a8c2..bdc391779f33fbcc7ad3638f07bcf92375f3f64c 100644 (file)
--- a/client.go
+++ b/client.go
@@ -1019,7 +1019,7 @@ func (s *DefaultDownloadStrategy) FillRequests(t *torrent, c *connection) {
        th := s.heat[t]
        addRequest := func(req request) (again bool) {
                piece := t.Pieces[req.Index]
-               if piece.Hashing {
+               if piece.Hashing || piece.QueuedForHash {
                        // We can't be sure we want this.
                        return true
                }