From b2860bad2140dec39b922b192e8e87a8657852ca Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 4 Feb 2018 22:43:28 +1100 Subject: [PATCH] Fix the connection completed string if peer sent HaveAll --- connection.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/connection.go b/connection.go index 6e22efc9..a49f4fa2 100644 --- a/connection.go +++ b/connection.go @@ -134,7 +134,11 @@ func (cn *connection) bestPeerNumPieces() int { } func (cn *connection) completedString() string { - return fmt.Sprintf("%d/%d", cn.peerPieces.Len(), cn.bestPeerNumPieces()) + have := cn.peerPieces.Len() + if cn.peerSentHaveAll { + have = cn.bestPeerNumPieces() + } + return fmt.Sprintf("%d/%d", have, cn.bestPeerNumPieces()) } // Correct the PeerPieces slice length. Return false if the existing slice is