Skip to content

Commit

Permalink
Merge pull request #3491 from ipfs/fix/swarm-peers-0-lat
Browse files Browse the repository at this point in the history
swarm/peers: print 'n/a' instead of zero latency
  • Loading branch information
whyrusleeping authored Dec 9, 2016
2 parents 2aded67 + 4f78f40 commit 477787c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/commands/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ var swarmPeersCmd = &cmds.Command{
}

if verbose || latency {
ci.Latency = n.Peerstore.LatencyEWMA(pid).String()
lat := n.Peerstore.LatencyEWMA(pid)
if lat == 0 {
ci.Latency = "n/a"
} else {
ci.Latency = lat.String()
}
}
if verbose || streams {
strs, err := c.GetStreams()
Expand Down

0 comments on commit 477787c

Please sign in to comment.