some more check on http sockets
This commit is contained in:
parent
647701822c
commit
917e457af0
1 changed files with 13 additions and 6 deletions
|
@ -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:
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue