mirror of
				https://github.com/ergochat/ergo.git
				synced 2025-10-30 21:37:23 +01:00 
			
		
		
		
	server: Add some comments and clean up a bit -- from jlatt/ergonomadic#39 <3
This commit is contained in:
		
							parent
							
								
									43553390d6
								
							
						
					
					
						commit
						a177ca36b1
					
				| @ -46,8 +46,12 @@ type Server struct { | ||||
| } | ||||
| 
 | ||||
| var ( | ||||
| 	SERVER_SIGNALS = []os.Signal{syscall.SIGINT, syscall.SIGHUP, | ||||
| 		syscall.SIGTERM, syscall.SIGQUIT} | ||||
| 	SERVER_SIGNALS = []os.Signal{ | ||||
| 		syscall.SIGINT, | ||||
| 		syscall.SIGHUP, // eventually we expect to use HUP to reload config | ||||
| 		syscall.SIGTERM, | ||||
| 		syscall.SIGQUIT, | ||||
| 	} | ||||
| ) | ||||
| 
 | ||||
| type clientConn struct { | ||||
| @ -113,6 +117,7 @@ func NewServer(config *Config) *Server { | ||||
| 		server.wslisten(config.Server.Wslisten, config.Server.TLSListeners) | ||||
| 	} | ||||
| 
 | ||||
| 	// Attempt to clean up when receiving these signals. | ||||
| 	signal.Notify(server.signals, SERVER_SIGNALS...) | ||||
| 
 | ||||
| 	// add RPL_ISUPPORT tokens | ||||
| @ -181,6 +186,10 @@ func (server *Server) Shutdown() { | ||||
| 	for _, client := range server.clients.byNick { | ||||
| 		client.Notice("Server is shutting down") | ||||
| 	} | ||||
| 
 | ||||
| 	if err := server.db.Close(); err != nil { | ||||
| 		Log.error.Println("Server.Shutdown: error:", err) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func (server *Server) Run() { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Daniel Oaks
						Daniel Oaks