From a768e841bcf7e3e4239a63ca0f93b007a8f0ee53 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Mon, 12 Jan 2015 06:28:51 +0000 Subject: [PATCH] update printout for net diag --- core/commands/diag.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/commands/diag.go b/core/commands/diag.go index 746868834..e817f939f 100644 --- a/core/commands/diag.go +++ b/core/commands/diag.go @@ -14,6 +14,7 @@ type DiagnosticConnection struct { ID string // TODO use milliseconds or microseconds for human readability NanosecondsLatency uint64 + Count int } type DiagnosticPeer struct { @@ -70,6 +71,7 @@ connected peers and latencies between them. connections[j] = DiagnosticConnection{ ID: conn.ID, NanosecondsLatency: uint64(conn.Latency.Nanoseconds()), + Count: conn.Count, } } @@ -102,16 +104,10 @@ connected peers and latencies between them. } func printDiagnostics(out io.Writer, info *DiagnosticOutput) error { - diagTmpl := ` {{ range $peer := .Peers }} -ID {{ $peer.ID }} - up {{ $peer.UptimeSeconds }} seconds - connected to {{ len .Connections }}... - {{ range $connection := .Connections }} - ID {{ $connection.ID }} - latency: {{ $connection.NanosecondsLatency }} ns - {{ end }} +ID {{ $peer.ID }} up {{ $peer.UptimeSeconds }} seconds connected to {{ len .Connections }}:{{ range $connection := .Connections }} + ID {{ $connection.ID }} connections: {{ $connection.Count }} latency: {{ $connection.NanosecondsLatency }} ns{{ end }} {{end}} `