mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
[FIXED] Monitoring: tls configuration not updated on reload
When creating the http server, we need to provide a TLS configuration. After a config reload, the new TLS config would not be reflected. We had the same issue with Websocket and was fixed with the use of tls.Config.GetConfigForClient API, which makes the TLS handshake to ask for a TLS config. That fix for websocket was simply not applied to the HTTPs monitoring case. I have also fixed some flappers due to the use of localhost instead of 127.0.0.1 (connections possibly would resolve to some IPv6 address that the server would not accept, etc..) Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
@@ -1112,7 +1112,7 @@ func (s *Server) startWebsocketServer() {
|
||||
Addr: hp,
|
||||
Handler: mux,
|
||||
ReadTimeout: o.HandshakeTimeout,
|
||||
ErrorLog: log.New(&wsCaptureHTTPServerLog{s}, _EMPTY_, 0),
|
||||
ErrorLog: log.New(&captureHTTPServerLog{s, "websocket: "}, _EMPTY_, 0),
|
||||
}
|
||||
s.websocket.server = hs
|
||||
s.websocket.listener = hl
|
||||
@@ -1239,24 +1239,6 @@ func (s *Server) createWSClient(conn net.Conn, ws *websocket) *client {
|
||||
return c
|
||||
}
|
||||
|
||||
type wsCaptureHTTPServerLog struct {
|
||||
s *Server
|
||||
}
|
||||
|
||||
func (cl *wsCaptureHTTPServerLog) Write(p []byte) (int, error) {
|
||||
var buf [128]byte
|
||||
var b = buf[:0]
|
||||
|
||||
copy(b, []byte("websocket :"))
|
||||
offset := 0
|
||||
if bytes.HasPrefix(p, []byte("http:")) {
|
||||
offset = 6
|
||||
}
|
||||
b = append(b, p[offset:]...)
|
||||
cl.s.Errorf(string(b))
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func (c *client) wsCollapsePtoNB() (net.Buffers, int64) {
|
||||
var nb net.Buffers
|
||||
var mfs int
|
||||
|
||||
Reference in New Issue
Block a user