* connection. Note that we create the client instead to check before
* for this condition, since now the socket is already set in nonblocking
* mode and we can send an error for free using the Kernel I/O */
* connection. Note that we create the client instead to check before
* for this condition, since now the socket is already set in nonblocking
* mode and we can send an error for free using the Kernel I/O */
char *err = "-ERR max number of clients reached\r\n";
/* That's a best effort error message, don't check write errors */
char *err = "-ERR max number of clients reached\r\n";
/* That's a best effort error message, don't check write errors */
/* Multi bulk length cannot be read without a \r\n */
newline = strchr(c->querybuf,'\r');
/* Multi bulk length cannot be read without a \r\n */
newline = strchr(c->querybuf,'\r');
/* We know for sure there is a whole line since newline != NULL,
* so go ahead and find out the multi bulk length. */
/* We know for sure there is a whole line since newline != NULL,
* so go ahead and find out the multi bulk length. */
ok = string2ll(c->querybuf+1,newline-(c->querybuf+1),&ll);
if (!ok || ll > 1024*1024) {
addReplyError(c,"Protocol error: invalid multibulk length");
ok = string2ll(c->querybuf+1,newline-(c->querybuf+1),&ll);
if (!ok || ll > 1024*1024) {
addReplyError(c,"Protocol error: invalid multibulk length");