Skip to content

Commit b920e17

Browse files
committed
Do not report error in getPeers before it has happened
1 parent a2272a0 commit b920e17

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/yggdrasilctl/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ func run() int {
190190
for _, peer := range resp.Peers {
191191
state, lasterr, dir, rtt, rxr, txr := "Up", "-", "Out", "-", "-", "-"
192192
if !peer.Up {
193-
state, lasterr = "Down", fmt.Sprintf("%s ago: %s", peer.LastErrorTime.Round(time.Second), peer.LastError)
193+
if state = "Down"; peer.LastError != "" {
194+
lasterr = fmt.Sprintf("%s ago: %s", peer.LastErrorTime.Round(time.Second), peer.LastError)
195+
}
194196
} else if rttms := float64(peer.Latency.Microseconds()) / 1000; rttms > 0 {
195197
rtt = fmt.Sprintf("%.02fms", rttms)
196198
}

0 commit comments

Comments
 (0)