"github.com/anacrolix/torrent/storage"
)
-// Currently doesn't really queue, but should in the future.
-func (cl *Client) queuePieceCheck(t *Torrent, pieceIndex int) {
- piece := &t.pieces[pieceIndex]
- if piece.QueuedForHash {
- return
- }
- piece.QueuedForHash = true
- t.publishPieceChange(pieceIndex)
- go t.verifyPiece(pieceIndex)
-}
-
// Clients contain zero or more Torrents. A Client manages a blocklist, the
// TCP/UDP protocol ports, and DHT as desired.
type Client struct {
// It's important that the piece is potentially queued before we check if
// the piece is still wanted, because if it is queued, it won't be wanted.
if t.pieceAllDirty(index) {
- cl.queuePieceCheck(t, int(req.Index))
+ t.queuePieceCheck(int(req.Index))
}
if c.peerTouchedPieces == nil {
}
return
}
+
+// Currently doesn't really queue, but should in the future.
+func (t *Torrent) queuePieceCheck(pieceIndex int) {
+ piece := &t.pieces[pieceIndex]
+ if piece.QueuedForHash {
+ return
+ }
+ piece.QueuedForHash = true
+ t.publishPieceChange(pieceIndex)
+ go t.verifyPiece(pieceIndex)
+}