mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-15 18:50:41 -07:00
Access server clients within lock.
This commit is contained in:
@@ -92,6 +92,7 @@ func (s *Server) HandleConnz(w http.ResponseWriter, r *http.Request) {
|
||||
// number total of clients. The resulting ConnInfo array
|
||||
// may be smaller if pagination is used.
|
||||
totalClients := len(s.clients)
|
||||
c.TotalLive = len(s.clients)
|
||||
|
||||
i := 0
|
||||
pairs := make(Pairs, totalClients)
|
||||
@@ -147,7 +148,6 @@ func (s *Server) HandleConnz(w http.ResponseWriter, r *http.Request) {
|
||||
// Now we have the real number of ConnInfo objects, we can set c.NumConns
|
||||
// and allocate the array
|
||||
c.NumConns = len(pairs)
|
||||
c.TotalLive = len(s.clients)
|
||||
c.Conns = make([]ConnInfo, c.NumConns)
|
||||
|
||||
i = 0
|
||||
|
||||
Reference in New Issue
Block a user