mirror of
https://github.com/fluencelabs/redis
synced 2025-06-14 09:41:21 +00:00
Take a pointer to the relevant entry of the command table in the client structure. This is generally a more sounding design, simplifies a few functions prototype, and as a side effect fixes a bug related to the conversion of EXPIRE -1 to DEL: before of this fix Redis tried to convert it into an EXPIREAT in the AOF code, regardless of our rewrite of the command.
This commit is contained in:
@ -30,6 +30,7 @@ redisClient *createClient(int fd) {
|
||||
c->reqtype = 0;
|
||||
c->argc = 0;
|
||||
c->argv = NULL;
|
||||
c->cmd = NULL;
|
||||
c->multibulklen = 0;
|
||||
c->bulklen = -1;
|
||||
c->sentlen = 0;
|
||||
@ -447,6 +448,7 @@ static void freeClientArgv(redisClient *c) {
|
||||
for (j = 0; j < c->argc; j++)
|
||||
decrRefCount(c->argv[j]);
|
||||
c->argc = 0;
|
||||
c->cmd = NULL;
|
||||
}
|
||||
|
||||
void freeClient(redisClient *c) {
|
||||
@ -947,5 +949,7 @@ void rewriteClientCommandVector(redisClient *c, int argc, ...) {
|
||||
/* Replace argv and argc with our new versions. */
|
||||
c->argv = argv;
|
||||
c->argc = argc;
|
||||
c->cmd = lookupCommand(c->argv[0]->ptr);
|
||||
redisAssert(c->cmd != NULL);
|
||||
va_end(ap);
|
||||
}
|
||||
|
Reference in New Issue
Block a user