5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-23 12:15:39 +00:00

Try to clean up UNIX domain admin sockets if shutdown properly

This commit is contained in:
Neil Alexander 2018-07-07 12:34:10 +01:00
parent 171e1e7823
commit 2a931df07a
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944
2 changed files with 11 additions and 0 deletions

View File

@ -227,6 +227,16 @@ func (a *admin) start() error {
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.
func (a *admin) listen() {
var l net.Listener

View File

@ -135,6 +135,7 @@ func (c *Core) Start(nc *config.NodeConfig, log *log.Logger) error {
func (c *Core) Stop() {
c.log.Println("Stopping...")
c.tun.close()
c.admin.stop()
}
// Generates a new encryption keypair. The encryption keys are used to