From d575877a5de09d49d8ffa6118f90421837699fca Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 17 Jul 2018 21:29:54 +1000 Subject: [PATCH] Wake connections that could send a request for a deleted piece I'm not sure this is entirely correct, but not doing it is probably less correct. It should help prevent stalls where writers aren't requesting because they're starved out of opportunities by other connections. --- connection.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/connection.go b/connection.go index 0393497c..883d6c8e 100644 --- a/connection.go +++ b/connection.go @@ -1483,8 +1483,11 @@ func (c *connection) deleteRequest(r request) bool { panic(n) } c.updateRequests() - // TODO: Other connections that aren't interested, and can provide this - // chunk might be wakeable? + for _c := range c.t.conns { + if !_c.Interested && _c != c && c.PeerHasPiece(pieceIndex(r.Index)) { + _c.updateRequests() + } + } return true } -- 2.48.1