Fix #72: Connected placeholder shouldn't resolve to true when when host is unreachable

This commit is contained in:
TwinProduction
2021-01-12 21:08:18 -05:00
parent a515335c15
commit aec867ae69
9 changed files with 279 additions and 121 deletions

View File

@ -70,6 +70,10 @@ func Ping(address string) (bool, time.Duration) {
return false, 0
}
if pinger.Statistics() != nil {
// If the packet loss is 100, it means that the packet didn't reach the host
if pinger.Statistics().PacketLoss == 100 {
return false, pinger.Timeout
}
return true, pinger.Statistics().MaxRtt
}
return true, 0