summaryrefslogtreecommitdiff
path: root/src/syncio.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-08-06 16:49:30 +0200
committerantirez <antirez@gmail.com>2015-08-06 18:12:20 +0200
commit88c716a0f57084bc7c4043371a95895664e3a578 (patch)
tree0affa66ff328be4964adf1ebb612d6bfea5401aa /src/syncio.c
parent55cb64bbfb7d4a32fd1289137631f0f0de4cd2d1 (diff)
downloadredis-88c716a0f57084bc7c4043371a95895664e3a578.tar.gz
syncWithMaster(): non blocking state machine.statemachine
Diffstat (limited to 'src/syncio.c')
-rw-r--r--src/syncio.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/syncio.c b/src/syncio.c
index 1d0e663c7..b2843d5fb 100644
--- a/src/syncio.c
+++ b/src/syncio.c
@@ -118,9 +118,7 @@ ssize_t syncRead(int fd, char *ptr, ssize_t size, long long timeout) {
}
/* Read a line making sure that every char will not require more than 'timeout'
- * milliseconds to be read. Empty newlines before the first non-empty line
- * are ignored. This is useful because since Redis sometimes uses empty
- * newlines in order to take the connection "alive".
+ * milliseconds to be read.
*
* On success the number of bytes read is returned, otherwise -1.
* On success the string is always correctly terminated with a 0 byte. */
@@ -133,15 +131,9 @@ ssize_t syncReadLine(int fd, char *ptr, ssize_t size, long long timeout) {
if (syncRead(fd,&c,1,timeout) == -1) return -1;
if (c == '\n') {
- /* Ignore empty lines, otherwise return to the caller. */
- if (nread != 0) {
- *ptr = '\0';
- if (nread && *(ptr-1) == '\r') *(ptr-1) = '\0';
- return nread;
- } else {
- /* Read again with a fresh timeout. */
- continue;
- }
+ *ptr = '\0';
+ if (nread && *(ptr-1) == '\r') *(ptr-1) = '\0';
+ return nread;
} else {
*ptr++ = c;
*ptr = '\0';