Commit 18baec33 authored by ale's avatar ale
Browse files

Wait for open requests to close on shutdown

parent e7c15fc4
......@@ -54,15 +54,19 @@ func main() {
log.Fatalf("error: %v", err)
}
done := make(chan struct{})
sigCh := make(chan os.Signal, 1)
go func() {
<-sigCh
log.Printf("terminating")
sockSrv.Close()
close(done)
}()
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
log.Printf("starting")
daemon.SdNotify(false, "READY=1")
sockSrv.Serve()
<-done
}
Supports Markdown
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