Fix datarace

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2023-09-25 12:04:42 -07:00
parent b70f874640
commit a0029181ae

View File

@@ -2654,7 +2654,9 @@ func (c *client) processRouteConnect(srv *Server, arg []byte, lang string) error
// We will take on their name since theirs is configured or higher then ours.
srv.setClusterName(proto.Cluster)
if !proto.Dynamic {
srv.getOpts().Cluster.Name = proto.Cluster
srv.optsMu.Lock()
srv.opts.Cluster.Name = proto.Cluster
srv.optsMu.Unlock()
}
c.mu.Lock()
remoteID := c.opts.Name