Fix protocol error caused by redis-benchmark
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 issue introduced by
@@ -632,6 +632,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);
