Commit 05d9267f by Iwasaki Yudai

Show message for force exit

1 parent ff927770
Showing with 8 additions and 3 deletions
...@@ -286,8 +286,11 @@ func (app *App) handleAuthToken(w http.ResponseWriter, r *http.Request) { ...@@ -286,8 +286,11 @@ func (app *App) handleAuthToken(w http.ResponseWriter, r *http.Request) {
func (app *App) Exit() (firstCall bool) { func (app *App) Exit() (firstCall bool) {
if app.server != nil { if app.server != nil {
log.Printf("Received Exit command, waiting for all clients to close sessions...") firstCall = app.server.Close()
return app.server.Close() if firstCall {
log.Printf("Received Exit command, waiting for all clients to close sessions...")
}
return firstCall
} }
return true return true
} }
......
...@@ -120,7 +120,9 @@ func registerSignals(app *app.App) { ...@@ -120,7 +120,9 @@ func registerSignals(app *app.App) {
s := <-sigChan s := <-sigChan
switch s { switch s {
case syscall.SIGINT, syscall.SIGTERM: case syscall.SIGINT, syscall.SIGTERM:
if !app.Exit() { if app.Exit() {
fmt.Println("Send ^C to force exit.")
} else {
os.Exit(5) os.Exit(5)
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!