Merge pull request #802 from MatthewH-code/master

Added setting "NoSleep" to disable sleeping
pull/794/head^2
cyoung 2020-05-15 15:07:06 -04:00 zatwierdzone przez GitHub
commit 5a47671866
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -1126,6 +1126,7 @@ type settings struct {
WiFiSecurityEnabled bool
WiFiPassphrase string
WiFiSmartEnabled bool // "Smart WiFi" - disables the default gateway for iOS.
NoSleep bool
}
type status struct {
@ -1200,6 +1201,7 @@ func defaultSettings() {
globalSettings.OwnshipModeS = "F00000"
globalSettings.DeveloperMode = false
globalSettings.StaticIps = make([]string, 0)
globalSettings.NoSleep = false
}
func readSettings() {

Wyświetl plik

@ -145,6 +145,9 @@ func getDHCPLeases() (map[string]string, error) {
***WARNING***: netMutex must be locked before calling this function.
*/
func isSleeping(k string) bool {
if globalSettings.NoSleep == true {
return false
}
ipAndPort := strings.Split(k, ":")
// No ping response. Assume disconnected/sleeping device.
if lastPing, ok := pingResponse[ipAndPort[0]]; !ok || stratuxClock.Since(lastPing) > (10*time.Second) {