mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-14 03:20:28 +00:00
Merge pull request #358 from neilalexander/unixadmin
Add a timeout on the UNIX admin socket check
This commit is contained in:
commit
035ace9824
@ -403,7 +403,7 @@ func (a *admin) listen() {
|
|||||||
case "unix":
|
case "unix":
|
||||||
if _, err := os.Stat(a.listenaddr[7:]); err == nil {
|
if _, err := os.Stat(a.listenaddr[7:]); err == nil {
|
||||||
a.core.log.Debugln("Admin socket", a.listenaddr[7:], "already exists, trying to clean up")
|
a.core.log.Debugln("Admin socket", a.listenaddr[7:], "already exists, trying to clean up")
|
||||||
if _, err := net.Dial("unix", a.listenaddr[7:]); err == nil {
|
if _, err := net.DialTimeout("unix", a.listenaddr[7:], time.Second*2); err == nil || err.(net.Error).Timeout() {
|
||||||
a.core.log.Errorln("Admin socket", a.listenaddr[7:], "already exists and is in use by another process")
|
a.core.log.Errorln("Admin socket", a.listenaddr[7:], "already exists and is in use by another process")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user