From fe5aea38c35e3fc35a744ad2de73543df553ae48 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 19 Nov 2019 11:56:02 +0100 Subject: [PATCH] Simplify PR #6551 implementation. --- src/sentinel.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/sentinel.c b/src/sentinel.c index d5f22b97f..42c4d2467 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -465,12 +465,6 @@ struct redisCommand sentinelcmds[] = { {"hello",helloCommand,-2,"no-script fast",0,NULL,0,0,0,0,0} }; -/* List of client types that are killed when an instance becomes a slave */ -const char* killedClientTypes[] = { - "normal", - "pubsub" -}; - /* This function overwrites a few normal Redis config default with Sentinel * specific defaults. */ void initSentinelConfig(void) { @@ -3955,7 +3949,6 @@ char *sentinelGetLeader(sentinelRedisInstance *master, uint64_t epoch) { int sentinelSendSlaveOf(sentinelRedisInstance *ri, char *host, int port) { char portstr[32]; int retval; - unsigned int curType; ll2string(portstr,sizeof(portstr),port); @@ -4000,11 +3993,11 @@ int sentinelSendSlaveOf(sentinelRedisInstance *ri, char *host, int port) { * an issue because CLIENT is variadic command, so Redis will not * recognized as a syntax error, and the transaction will not fail (but * only the unsupported command will fail). */ - for (curType = 0; curType < sizeof(killedClientTypes)/sizeof(killedClientTypes[0]); ++curType) { + for (int type = 0; type < 2; type++) { retval = redisAsyncCommand(ri->link->cc, sentinelDiscardReplyCallback, ri, "%s KILL TYPE %s", sentinelInstanceMapCommand(ri,"CLIENT"), - killedClientTypes[curType]); + type == 0 ? "normal" : "pubsub"); if (retval == C_ERR) return retval; ri->link->pending_commands++; }