mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
all: Cleanups enabled by Go 1.12
This commit is contained in:
parent
879f51b027
commit
1d99e5277a
@ -151,17 +151,14 @@ func monitorMain(runtimeOptions RuntimeOptions) {
|
|||||||
// Successful exit indicates an intentional shutdown
|
// Successful exit indicates an intentional shutdown
|
||||||
return
|
return
|
||||||
} else if exiterr, ok := err.(*exec.ExitError); ok {
|
} else if exiterr, ok := err.(*exec.ExitError); ok {
|
||||||
if status, ok := exiterr.Sys().(syscall.WaitStatus); ok {
|
if exiterr.ExitCode() == syncthing.ExitUpgrade.AsInt() {
|
||||||
switch status.ExitStatus() {
|
// Restart the monitor process to release the .old
|
||||||
case syncthing.ExitUpgrade.AsInt():
|
// binary as part of the upgrade process.
|
||||||
// Restart the monitor process to release the .old
|
l.Infoln("Restarting monitor...")
|
||||||
// binary as part of the upgrade process.
|
if err = restartMonitor(args); err != nil {
|
||||||
l.Infoln("Restarting monitor...")
|
l.Warnln("Restart:", err)
|
||||||
if err = restartMonitor(args); err != nil {
|
|
||||||
l.Warnln("Restart:", err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ var tlsCipherSuiteNames = map[uint16]string{
|
|||||||
|
|
||||||
var tlsVersionNames = map[uint16]string{
|
var tlsVersionNames = map[uint16]string{
|
||||||
tls.VersionTLS12: "TLS1.2",
|
tls.VersionTLS12: "TLS1.2",
|
||||||
772: "TLS1.3", // tls.VersionTLS13 constant available in Go 1.12+
|
tls.VersionTLS13: "TLS1.3",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Service listens and dials all configured unconnected devices, via supported
|
// Service listens and dials all configured unconnected devices, via supported
|
||||||
|
@ -35,23 +35,16 @@ func ExpandTilde(path string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getHomeDir() (string, error) {
|
func getHomeDir() (string, error) {
|
||||||
var home string
|
if runtime.GOOS == "windows" {
|
||||||
|
// Legacy -- we prioritize this for historical reasons, whereas
|
||||||
switch runtime.GOOS {
|
// os.UserHomeDir uses %USERPROFILE% always.
|
||||||
case "windows":
|
home := filepath.Join(os.Getenv("HomeDrive"), os.Getenv("HomePath"))
|
||||||
home = filepath.Join(os.Getenv("HomeDrive"), os.Getenv("HomePath"))
|
if home != "" {
|
||||||
if home == "" {
|
return home, nil
|
||||||
home = os.Getenv("UserProfile")
|
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
home = os.Getenv("HOME")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if home == "" {
|
return os.UserHomeDir()
|
||||||
return "", errNoHome
|
|
||||||
}
|
|
||||||
|
|
||||||
return home, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var windowsDisallowedCharacters = string([]rune{
|
var windowsDisallowedCharacters = string([]rune{
|
||||||
|
@ -20,7 +20,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/syncthing/syncthing/lib/build"
|
|
||||||
"github.com/syncthing/syncthing/lib/rand"
|
"github.com/syncthing/syncthing/lib/rand"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user