mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 13:01:39 +00:00
Try to clean up UNIX domain admin sockets if shutdown properly
This commit is contained in:
parent
171e1e7823
commit
2a931df07a
@ -227,6 +227,16 @@ func (a *admin) start() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cleans up when stopping
|
||||||
|
func (a *admin) stop() error {
|
||||||
|
if a.listenaddr[0:7] == "unix://" {
|
||||||
|
if err := os.Remove(a.listenaddr[7:]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// listen is run by start and manages API connections.
|
// listen is run by start and manages API connections.
|
||||||
func (a *admin) listen() {
|
func (a *admin) listen() {
|
||||||
var l net.Listener
|
var l net.Listener
|
||||||
|
@ -135,6 +135,7 @@ func (c *Core) Start(nc *config.NodeConfig, log *log.Logger) error {
|
|||||||
func (c *Core) Stop() {
|
func (c *Core) Stop() {
|
||||||
c.log.Println("Stopping...")
|
c.log.Println("Stopping...")
|
||||||
c.tun.close()
|
c.tun.close()
|
||||||
|
c.admin.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates a new encryption keypair. The encryption keys are used to
|
// Generates a new encryption keypair. The encryption keys are used to
|
||||||
|
Loading…
Reference in New Issue
Block a user