slave now detect lost connection during SYNC, fixing Issue 173

This commit is contained in:
antirez
2010-08-24 16:27:40 +02:00
parent 3a1ab86a35
commit dda93651f7

View File

@ -8074,9 +8074,9 @@ static int syncWithMaster(void) {
int nread, nwritten; int nread, nwritten;
nread = read(fd,buf,(dumpsize < 1024)?dumpsize:1024); 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", redisLog(REDIS_WARNING,"I/O error trying to sync with MASTER: %s",
strerror(errno)); (nread == -1) ? strerror(errno) : "connection lost");
close(fd); close(fd);
close(dfd); close(dfd);
return REDIS_ERR; return REDIS_ERR;