]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix the connection completed string if peer sent HaveAll
authorMatt Joiner <anacrolix@gmail.com>
Sun, 4 Feb 2018 11:43:28 +0000 (22:43 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 4 Feb 2018 11:43:28 +0000 (22:43 +1100)
connection.go

index 6e22efc9b37f43b5bb7297cf898b2492d6276b1a..a49f4fa27b0f43d16de638d2ddc377696b82869b 100644 (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