Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/grumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick <actown@users.noreply.github.com>2020-04-13 01:49:12 +0300
committerDerrick <actown@users.noreply.github.com>2020-04-13 01:49:12 +0300
commit68453fa6d657ff53d6f5f8c2c5a7b23a40f76562 (patch)
tree2abe5adb411d8c32d210be4008083936fa8fbf10
parent12775db8ce0b77bcd698b3b006c8369486c8eac1 (diff)
Tell servers to Stop when shutting down.
Run Stop() on all the server when a SIGINT or SIGTERM is received. This should ensure any open sockets and files are closed.
-rw-r--r--cmd/grumble/signal_unix.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd/grumble/signal_unix.go b/cmd/grumble/signal_unix.go
index 9066b49..02db23b 100644
--- a/cmd/grumble/signal_unix.go
+++ b/cmd/grumble/signal_unix.go
@@ -8,6 +8,7 @@ package main
import (
"fmt"
+ "log"
"os"
"os/signal"
"syscall"
@@ -27,6 +28,14 @@ func SignalHandler() {
continue
}
if sig == syscall.SIGINT || sig == syscall.SIGTERM {
+ for _, server := range servers {
+ log.Printf("Stopping server %v", server.Id)
+ err := server.Stop()
+ if err != nil {
+ log.Printf("Server err %v", err)
+ }
+ }
+ log.Print("All servers stopped. Exiting.")
os.Exit(0)
}
}