forked from mirror/ledisdb
fix slave role err, ip and port must be master
This commit is contained in:
parent
87cbf6cefc
commit
3cd534aefb
|
@ -188,9 +188,11 @@ func roleCommand(c *client) error {
|
|||
}
|
||||
|
||||
c.app.m.Lock()
|
||||
isMaster := len(c.app.cfg.SlaveOf) == 0
|
||||
slaveof := c.app.cfg.SlaveOf
|
||||
c.app.m.Unlock()
|
||||
|
||||
isMaster := len(slaveof) == 0
|
||||
|
||||
ay := make([]interface{}, 0, 5)
|
||||
|
||||
var lastId int64 = 0
|
||||
|
@ -217,7 +219,7 @@ func roleCommand(c *client) error {
|
|||
c.app.slock.Unlock()
|
||||
ay = append(ay, items)
|
||||
} else {
|
||||
host, port, _ := splitHostPort(c.app.cfg.Addr)
|
||||
host, port, _ := splitHostPort(slaveof)
|
||||
ay = append(ay, []byte("slave"))
|
||||
ay = append(ay, []byte(host))
|
||||
ay = append(ay, int64(port))
|
||||
|
|
Loading…
Reference in New Issue