From 7fb2886098287c08288bd0476be0f8ff25748952 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Sat, 8 Dec 2018 18:52:04 -0800 Subject: [PATCH] Add total to account conn updates Signed-off-by: Derek Collison --- server/const.go | 2 +- server/events.go | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/server/const.go b/server/const.go index 8ee1ae91..4a604c54 100644 --- a/server/const.go +++ b/server/const.go @@ -40,7 +40,7 @@ var ( const ( // VERSION is the current version for the server. - VERSION = "2.0.0-beta.7" + VERSION = "2.0.0-beta.8" // PROTO is the currently supported protocol. // 0 was the original diff --git a/server/events.go b/server/events.go index c1240120..cd469e56 100644 --- a/server/events.go +++ b/server/events.go @@ -88,9 +88,10 @@ type DisconnectEventMsg struct { // a given account when the number of connections changes. It will also HB // updates in the absence of any changes. type AccountNumConns struct { - Server ServerInfo `json:"server"` - Account string `json:"acc"` - Conns int `json:"conns"` + Server ServerInfo `json:"server"` + Account string `json:"acc"` + Conns int `json:"conns"` + TotalConns int `json:"total_conns"` } // accNumConnsReq is sent when we are starting to track an account for the first @@ -677,8 +678,9 @@ func (s *Server) sendAccConnsUpdate(a *Account, subj string) { // Build event with account name and number of local clients. m := AccountNumConns{ - Account: a.Name, - Conns: a.numLocalConnections(), + Account: a.Name, + Conns: a.numLocalConnections(), + TotalConns: len(s.clients), } a.mu.Unlock()