Clarify why remaining may be zero in readQueryFromClient().

See #5304.
This commit is contained in:
antirez 2018-09-04 13:29:24 +02:00
parent ff57b8d550
commit 4e5e0d3719

View File

@ -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;
} }