some more check on http sockets

This commit is contained in:
boyska 2018-11-10 17:28:02 +01:00
parent 647701822c
commit 917e457af0

View file

@ -63,21 +63,28 @@ func main() {
unixListener, err := net.Listen("unix", *querySocket) unixListener, err := net.Listen("unix", *querySocket)
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, "Error binding HTTP unix domain socket", err) fmt.Fprintln(os.Stderr, "Error binding HTTP unix domain socket", err)
return
} }
go http.Serve(unixListener, nil) go func() {
err := http.Serve(unixListener, nil)
if err != nil {
fmt.Fprintln(os.Stderr, "error binding:", err)
}
}()
} else { } else {
fmt.Printf("Binding address `%s` [http]\n", *queryAddr) fmt.Printf("Binding address `%s` [http]\n", *queryAddr)
go http.ListenAndServe(*queryAddr, nil) go func() {
err := http.ListenAndServe(*queryAddr, nil)
if err != nil {
fmt.Fprintln(os.Stderr, "error binding:", err)
}
}()
} }
for { for {
select { select {
case <-interrupt: case <-interrupt:
server.Kill() server.Kill()
//server.Wait()
if *syslogSocketPath != "" {
}
return return
default: default:
} }