swarm/peers: print 'n/a' instead of zero latency

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
Jeromy 2016-12-08 21:56:47 -08:00
parent b6c1155ac8
commit 4f78f40537

View File

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