mirror of https://github.com/tidwall/tile38.git
Fix a concurrent write/read on the server conn map
This commit is contained in:
parent
0490734b74
commit
84cabd77f9
|
@ -121,9 +121,13 @@ func (s *Server) cmdReplConf(msg *Message, client *Client) (res resp.Value, err
|
|||
}
|
||||
|
||||
// Apply the replication port to the client and return
|
||||
s.connsmu.RLock()
|
||||
defer s.connsmu.RUnlock()
|
||||
for _, c := range s.conns {
|
||||
if c.remoteAddr == client.remoteAddr {
|
||||
c.mu.Lock()
|
||||
c.replPort = port
|
||||
c.mu.Unlock()
|
||||
return OKMessage(msg, start), nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue