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)
if err != nil {
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 {
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 {
select {
case <-interrupt:
server.Kill()
//server.Wait()
if *syslogSocketPath != "" {
}
return
default:
}