mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Try to clean up UNIX domain admin sockets if shutdown properly
This commit is contained in:
		
							parent
							
								
									171e1e7823
								
							
						
					
					
						commit
						2a931df07a
					
				
					 2 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
					@ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue