change: config: handle NetProbe fatal error and run only if not offline

All errors returned from NetProbe are managed as fatal later.
Decide, connection issues are not fatal but bad configuration is.
Without this configuration errors are silently ignored here.
This commit is contained in:
Markus Linnala 2019-10-03 15:32:32 +03:00 committed by Frank Denis
parent 32c387318a
commit 8c6a968e27
3 changed files with 7 additions and 10 deletions

View File

@ -469,9 +469,10 @@ func ConfigLoad(proxy *Proxy, svcFlag *string) error {
proxy.listenAddresses = nil
}
dlog.Noticef("dnscrypt-proxy %s", AppVersion)
NetProbe(netprobeAddress, netprobeTimeout)
if !config.OfflineMode {
if err := NetProbe(netprobeAddress, netprobeTimeout); err != nil {
return err
}
if err := config.loadSources(proxy); err != nil {
return err
}

View File

@ -3,7 +3,6 @@
package main
import (
"errors"
"net"
"time"
@ -39,7 +38,6 @@ func NetProbe(address string, timeout int) error {
dlog.Notice("Network connectivity detected")
return nil
}
es := "Timeout while waiting for network connectivity"
dlog.Error(es)
return errors.New(es)
dlog.Error("Timeout while waiting for network connectivity")
return nil
}

View File

@ -1,7 +1,6 @@
package main
import (
"errors"
"net"
"time"
@ -43,7 +42,6 @@ func NetProbe(address string, timeout int) error {
dlog.Notice("Network connectivity detected")
return nil
}
es := "Timeout while waiting for network connectivity"
dlog.Error(es)
return errors.New(es)
dlog.Error("Timeout while waiting for network connectivity")
return nil
}