From: Matt Joiner Date: Sun, 4 Feb 2018 11:43:28 +0000 (+1100) Subject: Fix the connection completed string if peer sent HaveAll X-Git-Tag: v1.0.0~204 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=b2860bad2140dec39b922b192e8e87a8657852ca;p=btrtrc.git Fix the connection completed string if peer sent HaveAll --- 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