summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivanstosic-janea <82372754+ivanstosic-janea@users.noreply.github.com>2022-02-07 21:57:11 +0100
committerOran Agra <oran@redislabs.com>2022-04-27 16:31:52 +0300
commit0a26869a1331dff01643f457e83a1edc2a94b6c9 (patch)
tree5975c7b13ec10fd1a195aa9ab91ed90c6e014c43
parent2c529844fc0429268dadaead650eafae1e2f3ce2 (diff)
downloadredis-0a26869a1331dff01643f457e83a1edc2a94b6c9.tar.gz
Fix protocol error caused by redis-benchmark (#10236)
The protocol error was caused by the buggy `writeHandler` in `redis-benchmark.c`, which didn't handle one of the cases, thereby repeating data, leading to protocol errors when the values being sent are very long. This PR fixes #10233, issue introduced by #7959 (cherry picked from commit bb875603fb7ff3f9d19aad906bd45d7db98d9a39)
-rw-r--r--src/redis-benchmark.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c
index 8d510d7da..604a5b6f1 100644
--- a/src/redis-benchmark.c
+++ b/src/redis-benchmark.c
@@ -643,6 +643,9 @@ static void writeHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
fprintf(stderr, "Error writing to the server: %s\n", strerror(errno));
freeClient(c);
return;
+ } else if (nwritten > 0) {
+ c->written += nwritten;
+ return;
}
} else {
aeDeleteFileEvent(el,c->context->fd,AE_WRITABLE);