mirror of
https://github.com/status-im/consul.git
synced 2025-02-23 19:08:22 +00:00
agent/http: clean up socket setup
This commit is contained in:
parent
eda2171bbe
commit
b5e8111485
@ -64,11 +64,7 @@ func NewHTTPServers(agent *Agent, config *Config, logOutput io.Writer) ([]*HTTPS
|
|||||||
return nil, fmt.Errorf("Failed to get Listen on %s: %v", httpAddr.String(), err)
|
return nil, fmt.Errorf("Failed to get Listen on %s: %v", httpAddr.String(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := unixSocketAddr(config.Addresses.HTTPS); ok {
|
|
||||||
list = tls.NewListener(ln, tlsConfig)
|
|
||||||
} else {
|
|
||||||
list = tls.NewListener(tcpKeepAliveListener{ln.(*net.TCPListener)}, tlsConfig)
|
list = tls.NewListener(tcpKeepAliveListener{ln.(*net.TCPListener)}, tlsConfig)
|
||||||
}
|
|
||||||
|
|
||||||
// Create the mux
|
// Create the mux
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
@ -111,17 +107,14 @@ func NewHTTPServers(agent *Agent, config *Config, logOutput io.Writer) ([]*HTTPS
|
|||||||
return nil, fmt.Errorf("Failed to get Listen on %s: %v", httpAddr.String(), err)
|
return nil, fmt.Errorf("Failed to get Listen on %s: %v", httpAddr.String(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := unixSocketAddr(config.Addresses.HTTP); ok {
|
|
||||||
list = ln
|
|
||||||
} else {
|
|
||||||
list = tcpKeepAliveListener{ln.(*net.TCPListener)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up ownership/permission bits on the socket file
|
|
||||||
if isSocket {
|
if isSocket {
|
||||||
|
// Set up ownership/permission bits on the socket file
|
||||||
if err := setFilePermissions(socketPath, config.UnixSockets); err != nil {
|
if err := setFilePermissions(socketPath, config.UnixSockets); err != nil {
|
||||||
return nil, fmt.Errorf("Failed setting up HTTP socket: %s", err)
|
return nil, fmt.Errorf("Failed setting up HTTP socket: %s", err)
|
||||||
}
|
}
|
||||||
|
list = ln
|
||||||
|
} else {
|
||||||
|
list = tcpKeepAliveListener{ln.(*net.TCPListener)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the mux
|
// Create the mux
|
||||||
|
Loading…
x
Reference in New Issue
Block a user