}
log.Printf("%s: error reading from torrent storage pos=%d: %s", r.t, pos, err)
r.t.cl.mu.Lock()
- r.t.torrent.updatePieceCompletion(pi)
- r.t.torrent.updatePiecePriority(pi)
+ r.t.torrent.updateAllPieceCompletions()
+ r.t.torrent.updatePiecePriorities()
r.t.cl.mu.Unlock()
}
}
"github.com/anacrolix/missinggo/itertools"
"github.com/anacrolix/missinggo/perf"
"github.com/anacrolix/missinggo/pubsub"
+ "github.com/bradfitz/iter"
"github.com/anacrolix/torrent/bencode"
"github.com/anacrolix/torrent/metainfo"
}
return t.data.ReadAt(b, off)
}
+
+func (t *torrent) updateAllPieceCompletions() {
+ for i := range iter.N(t.numPieces()) {
+ t.updatePieceCompletion(i)
+ }
+}