Skip to content

Commit

Permalink
Fixed race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
derekcollison committed Aug 6, 2015
1 parent 0a0f322 commit bb0e642
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bb0e642

Please sign in to comment.