diff options
Diffstat (limited to 'src/replication.c')
-rwxr-xr-x | src/replication.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/replication.c b/src/replication.c index d8283590d..4d11cf6b3 100755 --- a/src/replication.c +++ b/src/replication.c @@ -697,11 +697,16 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) { goto error; } - /* We don't care about the reply, it can be +PONG or an error since - * the server requires AUTH. As long as it replies correctly, it's - * fine from our point of view. */ - if (buf[0] != '-' && buf[0] != '+') { - redisLog(REDIS_WARNING,"Unexpected reply to PING from master."); + /* We accept only two replies as valid, a positive +PONG reply + * (we just check for "+") or an authentication error. + * Note that older versions of Redis replied with "operation not + * permitted" instead of using a proper error code, so we test + * both. */ + if (buf[0] != '+' && + strncmp(buf,"-NOAUTH",7) != 0 && + strncmp(buf,"-ERR operation not permitted",28) != 0) + { + redisLog(REDIS_WARNING,"Error reply to PING from master: '%s'",buf); goto error; } else { redisLog(REDIS_NOTICE, @@ -924,7 +929,7 @@ void replicationCron(void) { * So slaves can implement an explicit timeout to masters, and will * be able to detect a link disconnection even if the TCP connection * will not actually go down. */ - if (!(server.cronloops % (server.repl_ping_slave_period * REDIS_HZ))) { + if (!(server.cronloops % (server.repl_ping_slave_period * server.hz))) { listIter li; listNode *ln; |