From 493916c2794e3ed8c1867cb5d6b3d7aa84a1875a Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 18 Aug 2017 01:48:19 +1000 Subject: [PATCH] Rename Torrent.connHasWantedPieces->connection.peerHasWantedPieces --- connection.go | 8 ++++++-- torrent.go | 4 ---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/connection.go b/connection.go index 39fc46cb..aca2b348 100644 --- a/connection.go +++ b/connection.go @@ -698,7 +698,7 @@ func (c *connection) useful() bool { if t.seeding() { return c.PeerInterested } - return t.connHasWantedPieces(c) + return c.peerHasWantedPieces() } func (c *connection) lastHelpful() (ret time.Time) { @@ -1023,7 +1023,7 @@ func (c *connection) upload() { return } seeding := t.seeding() - if !seeding && !t.connHasWantedPieces(c) { + if !seeding && !c.peerHasWantedPieces() { // There's no reason to upload to this peer. return } @@ -1079,3 +1079,7 @@ func (cn *connection) Drop() { func (cn *connection) netGoodPiecesDirtied() int { return cn.goodPiecesDirtied - cn.badPiecesDirtied } + +func (c *connection) peerHasWantedPieces() bool { + return !c.pieceRequestOrder.IsEmpty() +} diff --git a/torrent.go b/torrent.go index 337040f5..8230acbf 100644 --- a/torrent.go +++ b/torrent.go @@ -713,10 +713,6 @@ func (t *Torrent) wantPieceIndex(index int) bool { }) } -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 -- 2.48.1