diff --git a/internal/server/follow.go b/internal/server/follow.go index 856e532a..0ac1df12 100644 --- a/internal/server/follow.go +++ b/internal/server/follow.go @@ -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 } }