ledisdb/server/cmd_replication.go

21 lines
271 B
Go

package server
func slaveofCommand(c *client) error {
if len(c.args) > 1 {
return ErrCmdParams
}
master := ""
if len(c.args) == 1 {
master = string(c.args[0])
}
if err := c.app.slaveof(master); err != nil {
return err
}
c.writeStatus(OK)
return nil
}