Commit 4e5e0d37 authored by antirez's avatar antirez
Browse files

Clarify why remaining may be zero in readQueryFromClient().

See #5304.
parent ff57b8d5
...@@ -1466,6 +1466,8 @@ void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) { ...@@ -1466,6 +1466,8 @@ void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) {
{ {
ssize_t remaining = (size_t)(c->bulklen+2)-sdslen(c->querybuf); ssize_t remaining = (size_t)(c->bulklen+2)-sdslen(c->querybuf);
/* Note that the 'remaining' variable may be zero in some edge case,
* for example once we resume a blocked client after CLIENT PAUSE. */
if (remaining > 0 && remaining < readlen) readlen = remaining; if (remaining > 0 && remaining < readlen) readlen = remaining;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment