diff --git a/src/networking.c b/src/networking.c index ae97ca2602..eee8818670 100644 --- a/src/networking.c +++ b/src/networking.c @@ -3580,12 +3580,12 @@ NULL } else { addReplyErrorObject(c, shared.syntaxerr); } - } else if (!strcasecmp(c->argv[1]->ptr,"capa") && c->argc == 3) { - if (!strcasecmp(c->argv[2]->ptr,"redirect")) { + } else if (!strcasecmp(c->argv[1]->ptr, "capa") && c->argc == 3) { + if (!strcasecmp(c->argv[2]->ptr, "redirect")) { c->capa |= CLIENT_CAPA_REDIRECT; - addReply(c,shared.ok); + addReply(c, shared.ok); } else { - addReplyErrorObject(c,shared.syntaxerr); + addReplyErrorObject(c, shared.syntaxerr); } } else { addReplySubcommandSyntaxError(c); diff --git a/src/server.c b/src/server.c index d4014842a9..d3c39f5dcd 100644 --- a/src/server.c +++ b/src/server.c @@ -3867,14 +3867,9 @@ int processCommand(client *c) { } } - if (!server.cluster_enabled && - c->capa & CLIENT_CAPA_REDIRECT && - server.primary_host && - !mustObeyClient(c) && - (is_write_command || - (is_read_command && !(c->flags & CLIENT_READONLY)))) { - addReplyErrorSds(c,sdscatprintf(sdsempty(), "-REDIRECT %s:%d", - server.primary_host, server.primary_port)); + if (!server.cluster_enabled && c->capa & CLIENT_CAPA_REDIRECT && server.primary_host && !mustObeyClient(c) && + (is_write_command || (is_read_command && !(c->flags & CLIENT_READONLY)))) { + addReplyErrorSds(c, sdscatprintf(sdsempty(), "-REDIRECT %s:%d", server.primary_host, server.primary_port)); return C_OK; } diff --git a/src/server.h b/src/server.h index 92e7e1d0b5..6aa0ffa8f2 100644 --- a/src/server.h +++ b/src/server.h @@ -430,7 +430,7 @@ extern int configOOMScoreAdjValuesDefaults[CONFIG_OOM_COUNT]; #define CLIENT_AUTHENTICATED (1ULL << 52) /* Indicate a client has successfully authenticated */ /* Client capabilities */ -#define CLIENT_CAPA_REDIRECT (1<<0) /* Indicate that the client can handle redirection */ +#define CLIENT_CAPA_REDIRECT (1 << 0) /* Indicate that the client can handle redirection */ /* Client block type (btype field in client structure) * if CLIENT_BLOCKED flag is set. */