From 917e457af0c714659fe4d601b6fbb73f0d589ec1 Mon Sep 17 00:00:00 2001 From: boyska Date: Sat, 10 Nov 2018 17:28:02 +0100 Subject: [PATCH] some more check on http sockets --- cmd/circologd/main.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cmd/circologd/main.go b/cmd/circologd/main.go index 768cfbe..67b248f 100644 --- a/cmd/circologd/main.go +++ b/cmd/circologd/main.go @@ -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: }