if t.seeding() {
return c.PeerInterested
}
- return t.connHasWantedPieces(c)
+ return c.peerHasWantedPieces()
}
func (c *connection) lastHelpful() (ret time.Time) {
return
}
seeding := t.seeding()
- if !seeding && !t.connHasWantedPieces(c) {
+ if !seeding && !c.peerHasWantedPieces() {
// There's no reason to upload to this peer.
return
}
func (cn *connection) netGoodPiecesDirtied() int {
return cn.goodPiecesDirtied - cn.badPiecesDirtied
}
+
+func (c *connection) peerHasWantedPieces() bool {
+ return !c.pieceRequestOrder.IsEmpty()
+}
})
}
-func (t *Torrent) connHasWantedPieces(c *connection) bool {
- return !c.pieceRequestOrder.IsEmpty()
-}
-
// The worst connection is one that hasn't been sent, or sent anything useful
// for the longest. A bad connection is one that usually sends us unwanted
// pieces, or has been in worser half of the established connections for more