mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2026-05-22 13:56:30 +03:00
Do not report error in getPeers before it has happened
This commit is contained in:
@@ -190,7 +190,9 @@ func run() int {
|
|||||||
for _, peer := range resp.Peers {
|
for _, peer := range resp.Peers {
|
||||||
state, lasterr, dir, rtt, rxr, txr := "Up", "-", "Out", "-", "-", "-"
|
state, lasterr, dir, rtt, rxr, txr := "Up", "-", "Out", "-", "-", "-"
|
||||||
if !peer.Up {
|
if !peer.Up {
|
||||||
state, lasterr = "Down", fmt.Sprintf("%s ago: %s", peer.LastErrorTime.Round(time.Second), peer.LastError)
|
if state = "Down"; peer.LastError != "" {
|
||||||
|
lasterr = fmt.Sprintf("%s ago: %s", peer.LastErrorTime.Round(time.Second), peer.LastError)
|
||||||
|
}
|
||||||
} else if rttms := float64(peer.Latency.Microseconds()) / 1000; rttms > 0 {
|
} else if rttms := float64(peer.Latency.Microseconds()) / 1000; rttms > 0 {
|
||||||
rtt = fmt.Sprintf("%.02fms", rttms)
|
rtt = fmt.Sprintf("%.02fms", rttms)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user