Sentinel: fixes inverted strcmp() test preventing config updates.

The result of this one-char bug was pretty serious, if the new master
had the same port of the previous master, but just a different IP
address, non-leader Sentinels would not be able to recognize the
configuration change.

This commit fixes issue #1394.

Many thanks to @shanemadden that reported the bug and helped
investigating it.
This commit is contained in:
antirez 2013-11-25 10:57:20 +01:00
parent 8d547ebd56
commit 6f4fd55762

View File

@ -2025,7 +2025,7 @@ void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privd
if (msgmaster->config_epoch < master_config_epoch) {
msgmaster->config_epoch = master_config_epoch;
if (master_port != msgmaster->addr->port ||
!strcmp(msgmaster->addr->ip, token[5]))
strcmp(msgmaster->addr->ip, token[5]))
{
sentinelAddr *old_addr;