1
0
Форк 0
форк від boyska/circolog
This commit is contained in:
boyska 2018-11-10 17:41:45 +01:00
джерело c70e28ff27
коміт 86bdeed4a2

@ -3,10 +3,12 @@ package main
import (
"flag"
"fmt"
"log"
"net"
"net/http"
"os"
"os/signal"
"syscall"
"git.lattuga.net/boyska/circolog"
syslog "gopkg.in/mcuadros/go-syslog.v2"
@ -29,7 +31,7 @@ func main() {
flag.Parse()
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
hub := circolog.NewHub(*bufsize)
handler := syslog.NewChannelHandler(hub.LogMessages)
@ -85,7 +87,8 @@ func main() {
for {
select {
case <-interrupt:
case sig := <-interrupt:
log.Println("Quitting because of signal", sig)
server.Kill()
if err := httpServer.Close(); err != nil {
fmt.Fprintln(os.Stderr, "Error closing http server:", err)