@cryptotaxi247 / kubo / commits / a768e841b

update printout for net diag

Jeromy committed Jan 12, 2015 at 06:28 UTC a768e841bcf7e3e4239a63ca0f93b007a8f0ee53
1 file changed +4 -8
core/commands/diag.go
+4 -8
@@ -14,6 +14,7 @@ type DiagnosticConnection struct {
14 ID string
15 // TODO use milliseconds or microseconds for human readability
16 NanosecondsLatency uint64
17 + Count int
18 }
19
20 type DiagnosticPeer struct {
@@ -70,6 +71,7 @@ connected peers and latencies between them.
71 connections[j] = DiagnosticConnection{
72 ID: conn.ID,
73 NanosecondsLatency: uint64(conn.Latency.Nanoseconds()),
74 + Count: conn.Count,
75 }
76 }
77
@@ -102,16 +104,10 @@ connected peers and latencies between them.
104 }
105
106 func printDiagnostics(out io.Writer, info *DiagnosticOutput) error {
105 -
107 diagTmpl := `
108 {{ range $peer := .Peers }}
108 -ID {{ $peer.ID }}
109 - up {{ $peer.UptimeSeconds }} seconds
110 - connected to {{ len .Connections }}...
111 - {{ range $connection := .Connections }}
112 - ID {{ $connection.ID }}
113 - latency: {{ $connection.NanosecondsLatency }} ns
114 - {{ end }}
109 +ID {{ $peer.ID }} up {{ $peer.UptimeSeconds }} seconds connected to {{ len .Connections }}:{{ range $connection := .Connections }}
110 + ID {{ $connection.ID }} connections: {{ $connection.Count }} latency: {{ $connection.NanosecondsLatency }} ns{{ end }}
111 {{end}}
112 `
113