From ec5a5342a2d47e098046173cfc536642a45409fe Mon Sep 17 00:00:00 2001 From: saltatory Date: Fri, 9 Aug 2019 08:48:23 -0700 Subject: [PATCH] Added RLock on connections map --- internal/server/stats.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/server/stats.go b/internal/server/stats.go index 58e88567..6b66b1f2 100644 --- a/internal/server/stats.go +++ b/internal/server/stats.go @@ -365,6 +365,7 @@ func (c *Server) writeInfoReplication(w *bytes.Buffer) { } else { fmt.Fprintf(w, "role:master\r\n") var i int + c.connsmu.RLock() for _, cc := range c.conns { if cc.replPort != 0 { fmt.Fprintf(w, "slave%v:ip=%s,port=%v,state=online\r\n", i, @@ -372,6 +373,7 @@ func (c *Server) writeInfoReplication(w *bytes.Buffer) { i++ } } + c.connsmu.RUnlock() } fmt.Fprintf(w, "connected_slaves:%d\r\n", len(c.aofconnM)) // Number of connected slaves }