mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-16 19:14:41 -07:00
Hold lock for server on iteration
This commit is contained in:
@@ -60,13 +60,7 @@ func (s *Server) sendLocalSubsToRoute(route *client) {
|
||||
b := bytes.Buffer{}
|
||||
|
||||
s.mu.Lock()
|
||||
clients := make(map[uint64]*client)
|
||||
for i, c := range s.clients {
|
||||
clients[i] = c
|
||||
}
|
||||
s.mu.Unlock()
|
||||
|
||||
for _, client := range clients {
|
||||
for _, client := range s.clients {
|
||||
client.mu.Lock()
|
||||
subs := client.subs.All()
|
||||
client.mu.Unlock()
|
||||
@@ -78,6 +72,7 @@ func (s *Server) sendLocalSubsToRoute(route *client) {
|
||||
}
|
||||
}
|
||||
}
|
||||
s.mu.Unlock()
|
||||
|
||||
route.mu.Lock()
|
||||
defer route.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user