From 4f78f40537be9b2aac7a896dd783f1e4e1f5cee0 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Thu, 8 Dec 2016 21:56:47 -0800 Subject: [PATCH] swarm/peers: print 'n/a' instead of zero latency License: MIT Signed-off-by: Jeromy --- core/commands/swarm.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/commands/swarm.go b/core/commands/swarm.go index 4d7386e5512..3f914839847 100644 --- a/core/commands/swarm.go +++ b/core/commands/swarm.go @@ -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()