From fcb3382f4bdcf1a5a976993f1ae8ae9dd0ca5c3a Mon Sep 17 00:00:00 2001 From: Matthias Hanel Date: Thu, 1 Jul 2021 20:16:33 -0400 Subject: [PATCH] [fixed] CONNS system endpoint which had issues with header and empty msg Signed-off-by: Matthias Hanel --- server/events.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/events.go b/server/events.go index 069bcdda..172fa21c 100644 --- a/server/events.go +++ b/server/events.go @@ -1043,7 +1043,7 @@ func (s *Server) shutdownEventing() { } // Request for our local connection count. -func (s *Server) connsRequest(sub *subscription, _ *client, subject, reply string, msg []byte) { +func (s *Server) connsRequest(sub *subscription, c *client, subject, reply string, rmsg []byte) { if !s.eventsRunning() { return } @@ -1054,9 +1054,11 @@ func (s *Server) connsRequest(sub *subscription, _ *client, subject, reply strin } a := tk[accReqAccIndex] m := accNumConnsReq{Account: a} - if err := json.Unmarshal(msg, &m); err != nil { - s.sys.client.Errorf("Error unmarshalling account connections request message: %v", err) - return + if _, msg := c.msgParts(rmsg); len(msg) > 0 { + if err := json.Unmarshal(msg, &m); err != nil { + s.sys.client.Errorf("Error unmarshalling account connections request message: %v", err) + return + } } if m.Account != a { s.sys.client.Errorf("Error unmarshalled account does not match subject")