Browse Source

[Fix] Fix clen length for hiredis...

tags/2.6
Vsevolod Stakhov 4 years ago
parent
commit
5d09c6fb3d
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      contrib/hiredis/async.c

+ 3
- 3
contrib/hiredis/async.c View File

cstr += pvariant; cstr += pvariant;
clen -= pvariant; clen -= pvariant;


if (hasnext && clen >= 11 && strncasecmp(cstr,"subscribe\r\n",11) == 0) {
if (hasnext && clen >= 9 && strncasecmp(cstr,"subscribe\r\n",9) == 0) {
c->flags |= REDIS_SUBSCRIBED; c->flags |= REDIS_SUBSCRIBED;


/* Add every channel/pattern to the list of subscription callbacks. */ /* Add every channel/pattern to the list of subscription callbacks. */


if (ret == 0) sdsfree(sname); if (ret == 0) sdsfree(sname);
} }
} else if (clen >= 13 && strncasecmp(cstr,"unsubscribe\r\n",13) == 0) {
} else if (clen >= 11 && strncasecmp(cstr,"unsubscribe\r\n",11) == 0) {
/* It is only useful to call (P)UNSUBSCRIBE when the context is /* It is only useful to call (P)UNSUBSCRIBE when the context is
* subscribed to one or more channels or patterns. */ * subscribed to one or more channels or patterns. */
if (!(c->flags & REDIS_SUBSCRIBED)) return REDIS_ERR; if (!(c->flags & REDIS_SUBSCRIBED)) return REDIS_ERR;
/* (P)UNSUBSCRIBE does not have its own response: every channel or /* (P)UNSUBSCRIBE does not have its own response: every channel or
* pattern that is unsubscribed will receive a message. This means we * pattern that is unsubscribed will receive a message. This means we
* should not append a callback function for this command. */ * should not append a callback function for this command. */
} else if(clen >= 9 && strncasecmp(cstr,"monitor\r\n",9) == 0) {
} else if(clen >= 7 && strncasecmp(cstr,"monitor\r\n",7) == 0) {
/* Set monitor flag and push callback */ /* Set monitor flag and push callback */
c->flags |= REDIS_MONITORING; c->flags |= REDIS_MONITORING;
__redisPushCallback(&ac->replies,&cb); __redisPushCallback(&ac->replies,&cb);

Loading…
Cancel
Save