]> git.saurik.com Git - redis.git/commitdiff
slave now detect lost connection during SYNC, fixing Issue 173
authorantirez <antirez@gmail.com>
Tue, 24 Aug 2010 14:25:00 +0000 (16:25 +0200)
committerantirez <antirez@gmail.com>
Tue, 24 Aug 2010 14:25:00 +0000 (16:25 +0200)
src/replication.c

index 8937582019fe367d5809aeea3065b1476411af1b..363ce54ac802db07452987d441dc02248ef8aba8 100644 (file)
@@ -428,9 +428,9 @@ int syncWithMaster(void) {
         int nread, nwritten;
 
         nread = read(fd,buf,(dumpsize < 1024)?dumpsize:1024);
-        if (nread == -1) {
+        if (nread <= 0) {
             redisLog(REDIS_WARNING,"I/O error trying to sync with MASTER: %s",
-                strerror(errno));
+                (nread == -1) ? strerror(errno) : "connection lost");
             close(fd);
             close(dfd);
             return REDIS_ERR;