From a2566d66188a96562b4f9238497cd35bb14ea029 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 28 Feb 2013 15:00:09 +0100 Subject: [PATCH] Cluster: don't gossip about nodes that are not useful to the cluster. --- src/cluster.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/cluster.c b/src/cluster.c index c0f0416f..3670f482 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1099,10 +1099,17 @@ void clusterSendPing(clusterLink *link, int type) { clusterMsgDataGossip *gossip; int j; - /* Not interesting to gossip about ourself. - * Nor to send gossip info about HANDSHAKE state nodes (zero info). */ + /* In the gossip section don't include: + * 1) Myself. + * 2) Nodes in HANDSHAKE state. + * 3) Nodes with the NOADDR flag set. + * 4) Disconnected nodes if they don't have configured slots. + */ if (this == server.cluster->myself || - this->flags & REDIS_NODE_HANDSHAKE) { + this->flags & (REDIS_NODE_HANDSHAKE|REDIS_NODE_NOADDR) || + (this->link == NULL && + popcount(this->slots,sizeof(this->slots)) == 0)) + { freshnodes--; /* otherwise we may loop forever. */ continue; }