Guard account client map

This commit is contained in:
Jaime Piña
2021-03-26 10:30:16 -07:00
parent 3adbbd3069
commit 6095e8f46d

View File

@@ -1236,6 +1236,7 @@ func (s *Server) registerAccountNoLock(acc *Account) *Account {
// Finish account setup and store.
s.setAccountSublist(acc)
acc.mu.Lock()
if acc.clients == nil {
acc.clients = make(map[*client]struct{})
}
@@ -1245,7 +1246,6 @@ func (s *Server) registerAccountNoLock(acc *Account) *Account {
// During config reload, it is possible that account was
// already created (global account), so use locking and
// make sure we create only if needed.
acc.mu.Lock()
// TODO(dlc)- Double check that we need this for GWs.
if acc.rm == nil && s.opts != nil && s.shouldTrackSubscriptions() {
acc.rm = make(map[string]int32)