long elements;
int root = 0;
- /* Set error for nested multi bulks with depth > 2 */
- if (r->ridx == 3) {
+ /* Set error for nested multi bulks with depth > 7 */
+ if (r->ridx == 8) {
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
- "No support for nested multi bulk replies with depth > 2");
+ "No support for nested multi bulk replies with depth > 7");
return REDIS_ERR;
}
r->errstr[0] = '\0';
r->fn = &defaultFunctions;
r->buf = sdsempty();
+ r->maxbuf = REDIS_READER_MAX_BUF;
if (r->buf == NULL) {
free(r);
return NULL;
/* Copy the provided buffer. */
if (buf != NULL && len >= 1) {
/* Destroy internal buffer when it is empty and is quite large. */
- if (r->len == 0 && sdsavail(r->buf) > 16*1024) {
+ if (r->len == 0 && r->maxbuf != 0 && sdsavail(r->buf) > r->maxbuf) {
sdsfree(r->buf);
r->buf = sdsempty();
r->pos = 0;
* After this function is called, you may use redisContextReadReply to
* see if there is a reply available. */
int redisBufferRead(redisContext *c) {
- char buf[2048];
+ char buf[1024*16];
int nread;
/* Return early when the context has seen an error. */