summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-04-11 19:12:29 +0200
committerantirez <antirez@gmail.com>2013-05-03 15:42:59 +0200
commit1315b9f2463b59b8dae440e62657be91363e29c7 (patch)
tree1f8eb994a529fb9855312522326d4187ce197009
parentae71731019317e171781300f67b81e9857551dc2 (diff)
downloadredis-1315b9f2463b59b8dae440e62657be91363e29c7.tar.gz
Cluster: restore PING sent time on reconnections.
-rw-r--r--src/cluster.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cluster.c b/src/cluster.c
index 39e040c09..24c933740 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -1529,6 +1529,7 @@ void clusterCron(void) {
if (node->flags & (REDIS_NODE_MYSELF|REDIS_NODE_NOADDR)) continue;
if (node->link == NULL) {
int fd;
+ time_t old_ping_sent;
clusterLink *link;
fd = anetTcpNonBlockConnect(server.neterr, node->ip,
@@ -1544,8 +1545,15 @@ void clusterCron(void) {
* If the node is flagged as MEET, we send a MEET message instead
* of a PING one, to force the receiver to add us in its node
* table. */
+ old_ping_sent = node->ping_sent;
clusterSendPing(link, node->flags & REDIS_NODE_MEET ?
CLUSTERMSG_TYPE_MEET : CLUSTERMSG_TYPE_PING);
+ if (old_ping_sent) {
+ /* If there was an active ping before the link was
+ * disconnected, we want to restore the ping time, otherwise
+ * replaced by the clusterSendPing() call. */
+ node->ping_sent = old_ping_sent;
+ }
/* We can clear the flag after the first packet is sent.
* If we'll never receive a PONG, we'll never send new packets
* to this node. Instead after the PONG is received and we