Commit 600a6115 authored by Bas Westerbaan's avatar Bas Westerbaan

Catch more signals for graceful shutdown

parent 6f51696d
......@@ -25,6 +25,7 @@ import (
"os/signal"
"strings"
"sync"
"syscall"
"time"
)
......@@ -522,10 +523,12 @@ func main() {
// set up signal handler to catch keyboard interrupt
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt)
signal.Notify(signalChan, syscall.SIGHUP, syscall.SIGINT,
syscall.SIGTERM, syscall.SIGQUIT)
go func() {
<-signalChan
log.Printf("SIGINT received, closing XMSS[MT] private key container")
code := <-signalChan
log.Printf("Signal %d received, closing XMSS[MT] private key container",
code)
if err := xmssmtSk.Close(); err != nil {
log.Printf(" ... failed: %v", err)
os.Exit(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment