Skip to content

Commit

Permalink
make clang-format happy
Browse files Browse the repository at this point in the history
Signed-off-by: zhaozhao.zz <[email protected]>
  • Loading branch information
soloestoy committed Jun 18, 2024
1 parent 4079daa commit 9f35e01
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 3 additions & 8 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 9f35e01

Please sign in to comment.