mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 00:52:38 +00:00
Replicas aren't allowed to run the replicaof command
This commit is contained in:
parent
825843db9e
commit
39ccce033a
@ -2023,6 +2023,14 @@ void slaveofCommand(client *c) {
|
|||||||
} else {
|
} else {
|
||||||
long port;
|
long port;
|
||||||
|
|
||||||
|
if (c->flags & CLIENT_SLAVE)
|
||||||
|
{
|
||||||
|
/* If a client is already a replica they cannot run this command,
|
||||||
|
* because it involves flushing all replicas (including this client) */
|
||||||
|
addReplyError(c, "Command is not valid when client is a replica.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((getLongFromObjectOrReply(c, c->argv[2], &port, NULL) != C_OK))
|
if ((getLongFromObjectOrReply(c, c->argv[2], &port, NULL) != C_OK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user