Skip to content

Instantly share code, notes, and snippets.

@antirez
Created September 29, 2015 16:09
Show Gist options
  • Save antirez/6a9d5dc875cb8b2a3488 to your computer and use it in GitHub Desktop.
Save antirez/6a9d5dc875cb8b2a3488 to your computer and use it in GitHub Desktop.
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 88f39a6..7524712 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -1444,6 +1444,7 @@ static void pipeMode(void) {
redisReaderFeed(reader,ibuf,nread);
last_read_time = time(NULL);
}
+ printf("."); fflush(stdout);
} while(nread > 0);
/* Consume replies. */
@@ -1475,6 +1476,8 @@ static void pipeMode(void) {
/* Handle the writable state: we can send protocol to the server. */
if (mask & AE_WRITABLE) {
+ ssize_t loop_nwritten = 0;
+
while(1) {
/* Transfer current buffer to server. */
if (obuf_len != 0) {
@@ -1491,6 +1494,7 @@ static void pipeMode(void) {
}
obuf_len -= nwritten;
obuf_pos += nwritten;
+ loop_nwritten += nwritten;
if (obuf_len != 0) break; /* Can't accept more data. */
}
/* If buffer is empty, load from stdin. */
@@ -1526,7 +1530,8 @@ static void pipeMode(void) {
obuf_pos = 0;
}
}
- if (obuf_len == 0 && eof) break;
+ if ((obuf_len == 0 && eof) ||
+ loop_nwritten > (128*1024)) break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment