From b2dedd9da8afad8e86b32d2d0e7c5e7bbbf92c8c Mon Sep 17 00:00:00 2001 From: antirez Date: Sat, 21 Dec 2013 00:23:37 +0100 Subject: [PATCH] Log when a slave lose the connection with its master. --- src/networking.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/networking.c b/src/networking.c index aee54b75..0661137d 100644 --- a/src/networking.c +++ b/src/networking.c @@ -654,15 +654,16 @@ void freeClient(redisClient *c) { * * Note that before doing this we make sure that the client is not in * some unexpected state, by checking its flags. */ - if (server.master && - (c->flags & REDIS_MASTER) && - !(c->flags & (REDIS_CLOSE_AFTER_REPLY| - REDIS_CLOSE_ASAP| - REDIS_BLOCKED| - REDIS_UNBLOCKED))) - { - replicationCacheMaster(c); - return; + if (server.master && c->flags & REDIS_MASTER) { + redisLog(REDIS_WARNING,"Connection with master lost."); + if (!(c->flags & (REDIS_CLOSE_AFTER_REPLY| + REDIS_CLOSE_ASAP| + REDIS_BLOCKED| + REDIS_UNBLOCKED))) + { + replicationCacheMaster(c); + return; + } } /* Free the query buffer */