mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-16 19:14:41 -07:00
Gateways: data race when setting first ping timer
This was introduced when fixing #2881. The call to setFirstPingTimer needed to be done under the client's lock. Moved setFirstPingTimer from a server receiver to a client receiver. The only reason it was a server receiver is because we need the server options, but c.srv is always set when invoking this function, so we will get the server from c.srv in that function now. Related to #2881 Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
@@ -1402,7 +1402,7 @@ func (c *client) processLeafNodeConnect(s *Server, arg []byte, lang string) erro
|
||||
}
|
||||
|
||||
// Set the Ping timer
|
||||
s.setFirstPingTimer(c)
|
||||
c.setFirstPingTimer()
|
||||
|
||||
// If we received pub deny permissions from the other end, merge with existing ones.
|
||||
c.mergeDenyPermissions(pub, proto.DenyPub)
|
||||
@@ -2526,7 +2526,7 @@ func (s *Server) leafNodeFinishConnectProcess(c *client) {
|
||||
c.mu.Lock()
|
||||
closed := c.isClosed()
|
||||
if !closed {
|
||||
s.setFirstPingTimer(c)
|
||||
c.setFirstPingTimer()
|
||||
}
|
||||
c.mu.Unlock()
|
||||
if closed {
|
||||
|
||||
Reference in New Issue
Block a user