Merge pull request #510 from jamez70/fix_crash_in_issleeping

Fix crash in issleeping
pull/512/head
cyoung 2016-10-18 12:00:55 -04:00 zatwierdzone przez GitHub
commit b9a9dd427d
1 zmienionych plików z 1 dodań i 2 usunięć

Wyświetl plik

@ -123,9 +123,8 @@ func getDHCPLeases() (map[string]string, error) {
func isSleeping(k string) bool {
ipAndPort := strings.Split(k, ":")
lastPing, ok := pingResponse[ipAndPort[0]]
// No ping response. Assume disconnected/sleeping device.
if !ok || stratuxClock.Since(lastPing) > (10*time.Second) {
if lastPing, ok := pingResponse[ipAndPort[0]]; !ok || stratuxClock.Since(lastPing) > (10*time.Second) {
return true
}
if stratuxClock.Since(outSockets[k].LastUnreachable) < (5 * time.Second) {