mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-14 10:10:42 -07:00
Fixed race condition
This commit is contained in:
@@ -778,16 +778,20 @@ func (c *client) processMsg(msg []byte) {
|
||||
if rmap == nil {
|
||||
rmap = make(map[string]struct{}, srv.numRoutes())
|
||||
}
|
||||
if sub.client == nil || sub.client.nc == nil || sub.client.route == nil ||
|
||||
sub.client.mu.Lock()
|
||||
if sub.client.nc == nil || sub.client.route == nil ||
|
||||
sub.client.route.remoteID == "" {
|
||||
c.Debugf("Bad or Missing ROUTER Identity, not processing msg")
|
||||
sub.client.mu.Unlock()
|
||||
continue
|
||||
}
|
||||
if _, ok := rmap[sub.client.route.remoteID]; ok {
|
||||
c.Debugf("Ignoring route, already processed")
|
||||
sub.client.mu.Unlock()
|
||||
continue
|
||||
}
|
||||
rmap[sub.client.route.remoteID] = routeSeen
|
||||
sub.client.mu.Unlock()
|
||||
}
|
||||
|
||||
mh := c.msgHeader(msgh[:si], sub)
|
||||
|
||||
Reference in New Issue
Block a user