File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,12 @@ type Server struct {
4646}
4747
4848var (
49- SERVER_SIGNALS = []os.Signal {syscall .SIGINT , syscall .SIGHUP ,
50- syscall .SIGTERM , syscall .SIGQUIT }
49+ SERVER_SIGNALS = []os.Signal {
50+ syscall .SIGINT ,
51+ syscall .SIGHUP , // eventually we expect to use HUP to reload config
52+ syscall .SIGTERM ,
53+ syscall .SIGQUIT ,
54+ }
5155)
5256
5357type clientConn struct {
@@ -113,6 +117,7 @@ func NewServer(config *Config) *Server {
113117 server .wslisten (config .Server .Wslisten , config .Server .TLSListeners )
114118 }
115119
120+ // Attempt to clean up when receiving these signals.
116121 signal .Notify (server .signals , SERVER_SIGNALS ... )
117122
118123 // add RPL_ISUPPORT tokens
@@ -181,6 +186,10 @@ func (server *Server) Shutdown() {
181186 for _ , client := range server .clients .byNick {
182187 client .Notice ("Server is shutting down" )
183188 }
189+
190+ if err := server .db .Close (); err != nil {
191+ Log .error .Println ("Server.Shutdown: error:" , err )
192+ }
184193}
185194
186195func (server * Server ) Run () {
You can’t perform that action at this time.
0 commit comments