Fix the connection completed string if peer sent HaveAll

This commit is contained in:
Matt Joiner 2018-02-04 22:43:28 +11:00
parent 2e36ad19d9
commit b2860bad21
1 changed files with 5 additions and 1 deletions

View File

@ -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