mirror of https://github.com/tidwall/tile38.git
Added RLock on connections map
This commit is contained in:
parent
815d7bc43d
commit
ec5a5342a2
|
@ -365,6 +365,7 @@ func (c *Server) writeInfoReplication(w *bytes.Buffer) {
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(w, "role:master\r\n")
|
fmt.Fprintf(w, "role:master\r\n")
|
||||||
var i int
|
var i int
|
||||||
|
c.connsmu.RLock()
|
||||||
for _, cc := range c.conns {
|
for _, cc := range c.conns {
|
||||||
if cc.replPort != 0 {
|
if cc.replPort != 0 {
|
||||||
fmt.Fprintf(w, "slave%v:ip=%s,port=%v,state=online\r\n", i,
|
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++
|
i++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
c.connsmu.RUnlock()
|
||||||
}
|
}
|
||||||
fmt.Fprintf(w, "connected_slaves:%d\r\n", len(c.aofconnM)) // Number of connected slaves
|
fmt.Fprintf(w, "connected_slaves:%d\r\n", len(c.aofconnM)) // Number of connected slaves
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue