From abe81781aeaeb0d7d3837df6c5cba71f0fae5161 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 2 Oct 2013 09:42:35 +0200 Subject: [PATCH] Cluster: FAIL messages from unknown senders are handled better. Previously the event was not logged but instead the node reported an unknown packet type received. --- src/cluster.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/cluster.c b/src/cluster.c index ab5283933..9328ab1be 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1154,20 +1154,26 @@ int clusterProcessPacket(clusterLink *link) { /* Update the cluster state if needed */ if (update_state) clusterUpdateState(); if (update_config) clusterSaveConfigOrDie(); - } else if (type == CLUSTERMSG_TYPE_FAIL && sender) { + } else if (type == CLUSTERMSG_TYPE_FAIL) { clusterNode *failing; - failing = clusterLookupNode(hdr->data.fail.about.nodename); - if (failing && !(failing->flags & (REDIS_NODE_FAIL|REDIS_NODE_MYSELF))) - { + if (sender) { + failing = clusterLookupNode(hdr->data.fail.about.nodename); + if (failing && !(failing->flags & (REDIS_NODE_FAIL|REDIS_NODE_MYSELF))) + { + redisLog(REDIS_NOTICE, + "FAIL message received from %.40s about %.40s", + hdr->sender, hdr->data.fail.about.nodename); + failing->flags |= REDIS_NODE_FAIL; + failing->fail_time = time(NULL); + failing->flags &= ~REDIS_NODE_PFAIL; + clusterUpdateState(); + clusterSaveConfigOrDie(); + } + } else { redisLog(REDIS_NOTICE, - "FAIL message received from %.40s about %.40s", + "Ignoring FAIL message from unknonw node %.40s about %.40s", hdr->sender, hdr->data.fail.about.nodename); - failing->flags |= REDIS_NODE_FAIL; - failing->fail_time = time(NULL); - failing->flags &= ~REDIS_NODE_PFAIL; - clusterUpdateState(); - clusterSaveConfigOrDie(); } } else if (type == CLUSTERMSG_TYPE_PUBLISH) { robj *channel, *message;