torrent.go | 21 --------------------- diff --git a/torrent.go b/torrent.go index 93d7d5f4a5795155adf548a71cc7dea7d634fd05..1db0d4010602c4132b3601470ab271a37aa44f2e 100644 --- a/torrent.go +++ b/torrent.go @@ -8,7 +8,6 @@ "crypto/sha1" "errors" "fmt" "io" - "math/rand" "net/http" "net/url" "sort" @@ -138,11 +137,6 @@ // Pieces that need to be hashed. piecesQueuedForHash bitmap.Bitmap activePieceHashes int initialPieceCheckDisabled bool - - // A pool of piece priorities []int for assignment to new connections. - // These "inclinations" are used to give connections preference for - // different pieces. - connPieceInclinationPool sync.Pool // Count of each request across active connections. pendingRequests pendingRequests @@ -1220,21 +1214,6 @@ t.initiateConn(p) initiated++ } return -} - -func (t *Torrent) getConnPieceInclination() []int { - _ret := t.connPieceInclinationPool.Get() - if _ret == nil { - pieceInclinationsNew.Add(1) - return rand.Perm(int(t.numPieces())) - } - pieceInclinationsReused.Add(1) - return *_ret.(*[]int) -} - -func (t *Torrent) putPieceInclination(pi []int) { - t.connPieceInclinationPool.Put(&pi) - pieceInclinationsPut.Add(1) } func (t *Torrent) updatePieceCompletion(piece pieceIndex) bool {