connection.go | 11 +++++++---- diff --git a/connection.go b/connection.go index f53402b4030111ad801c0fa1d35f1e29c38015a9..4147cd769a6878a42849d8743b775448198a47c3 100644 --- a/connection.go +++ b/connection.go @@ -794,7 +794,7 @@ cn.t.stats.readBytes(n) } } -// Returns whether the connection is currently useful to us. We're seeding and +// Returns whether the connection could be useful to us. We're seeding and // they want data, we don't have metainfo and they can provide it, etc. func (c *connection) useful() bool { t := c.t @@ -804,10 +804,13 @@ } if !t.haveInfo() { return c.supportsExtension("ut_metadata") } - if t.seeding() { - return c.PeerInterested + if t.seeding() && c.PeerInterested { + return true + } + if c.peerHasWantedPieces() { + return true } - return c.peerHasWantedPieces() + return false } func (c *connection) lastHelpful() (ret time.Time) {