]> Sergey Matveev's repositories - btrtrc.git/blobdiff - torrent.go
Refresh all piece completion states when data is missing
[btrtrc.git] / torrent.go
index daca65c0a3871fe2fc4a3e1146150a2c6e8a86dc..3bbbcef8623bb73417fdc83b0dde7ad650403a8f 100644 (file)
@@ -17,6 +17,7 @@ import (
        "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"
@@ -1050,3 +1051,9 @@ func (t *torrent) readAt(b []byte, off int64) (n int, err error) {
        }
        return t.data.ReadAt(b, off)
 }
+
+func (t *torrent) updateAllPieceCompletions() {
+       for i := range iter.N(t.numPieces()) {
+               t.updatePieceCompletion(i)
+       }
+}