commit 457fdd7e334eb5ef875dc4f8e61f4fda8183fb95 parent e084c3ba526d43b65d2fdbe2fd041d5522aa4cc1 Author: Robert Russell <robertrussell.72001@gmail.com> Date: Sun, 14 Jul 2024 22:34:27 -0700 Change soft exit signal handling Diffstat:
| M | tlsrp.go | | | 13 | ++++++++----- |
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/tlsrp.go b/tlsrp.go @@ -423,15 +423,18 @@ func manageExit() { softExiting := false for sig := range sigs { switch sig { - case unix.SIGINT: + case unix.SIGINT, unix.SIGQUIT: if !softExiting { - log.Println("received SIGINT; exiting softly") + log.Println("received SIGINT/SIGQUIT; exiting softly") close(softExit) softExiting = true + } else { + log.Println("received another SIGINT/SIGQUIT; exiting harshly") + close(hardExit) + return } - // Keep going in case we receive hard exit signal. - case unix.SIGQUIT, unix.SIGTERM: - log.Println("received SIGQUIT/SIGTERM; exiting harshly") + case unix.SIGTERM: + log.Println("received SIGTERM; exiting harshly") close(hardExit) return }