]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Move method queuePieceCheck
authorMatt Joiner <anacrolix@gmail.com>
Sun, 1 Jan 2017 00:02:37 +0000 (11:02 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 1 Jan 2017 00:02:37 +0000 (11:02 +1100)
client.go
connection.go
torrent.go

index 9c0aa622155e8503eadd70fbc589c112cd55c341..4250ef4f43428f11a54cf4133254037e7f83a04f 100644 (file)
--- a/client.go
+++ b/client.go
@@ -34,17 +34,6 @@ import (
        "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 {
index 60ebb2326595ecde988052a76265e6a294130fa3..945fc879958c80235658a1a32e8f99fa42e1ab94 100644 (file)
@@ -987,7 +987,7 @@ func (c *connection) receiveChunk(msg *pp.Message) {
        // 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 {
index cdeb7ceed510483cfbcbd1ad64989263cecf68dc..6702be8510e9ba5576a8f318ce53becc13c2f8df 100644 (file)
@@ -1546,3 +1546,14 @@ func (t *Torrent) connsAsSlice() (ret []*connection) {
        }
        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)
+}