Fix regressions from RESP3 changes in commit c8304b099d82dba4da35f4cfaa99595bcdb46d1a
Former-commit-id: c5cbb77fc7e3b2b5124b9432e144d8c74190c755
This commit is contained in:
parent
b7fff89e3e
commit
dd5152f836
@ -839,8 +839,11 @@ void addReplyNullCore(client *c, bool fAsync) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addReplyNull(client *c) {
|
void addReplyNull(client *c, robj_roptr objOldProtocol) {
|
||||||
addReplyNullCore(c, false);
|
if (c->resp < 3 && objOldProtocol != nullptr)
|
||||||
|
addReply(c, objOldProtocol);
|
||||||
|
else
|
||||||
|
addReplyNullCore(c, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addReplyNullAsync(client *c) {
|
void addReplyNullAsync(client *c) {
|
||||||
@ -932,7 +935,10 @@ void addReplyBulkSdsAsync(client *c, sds s) {
|
|||||||
/* Add a C null term string as bulk reply */
|
/* Add a C null term string as bulk reply */
|
||||||
void addReplyBulkCStringCore(client *c, const char *s, bool fAsync) {
|
void addReplyBulkCStringCore(client *c, const char *s, bool fAsync) {
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
addReplyNullCore(c,fAsync);
|
if (c->resp < 3)
|
||||||
|
addReplyCore(c,shared.nullbulk, fAsync);
|
||||||
|
else
|
||||||
|
addReplyNullCore(c,fAsync);
|
||||||
} else {
|
} else {
|
||||||
addReplyBulkCBufferCore(c,s,strlen(s),fAsync);
|
addReplyBulkCBufferCore(c,s,strlen(s),fAsync);
|
||||||
}
|
}
|
||||||
@ -2540,7 +2546,7 @@ NULL
|
|||||||
if (c->name)
|
if (c->name)
|
||||||
addReplyBulk(c,c->name);
|
addReplyBulk(c,c->name);
|
||||||
else
|
else
|
||||||
addReplyNull(c);
|
addReplyNull(c, shared.nullbulk);
|
||||||
} else if (!strcasecmp((const char*)ptrFromObj(c->argv[1]),"pause") && c->argc == 3) {
|
} else if (!strcasecmp((const char*)ptrFromObj(c->argv[1]),"pause") && c->argc == 3) {
|
||||||
long long duration;
|
long long duration;
|
||||||
|
|
||||||
|
@ -1341,7 +1341,7 @@ NULL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((de = dictFind(c->db->pdict,ptrFromObj(c->argv[2]))) == NULL) {
|
if ((de = dictFind(c->db->pdict,ptrFromObj(c->argv[2]))) == NULL) {
|
||||||
addReplyNull(c);
|
addReplyNull(c, shared.nullbulk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
size_t usage = objectComputeSize((robj*)dictGetVal(de),samples);
|
size_t usage = objectComputeSize((robj*)dictGetVal(de),samples);
|
||||||
|
@ -84,7 +84,7 @@ void addReplyPubsubUnsubscribed(client *c, robj *channel) {
|
|||||||
if (channel)
|
if (channel)
|
||||||
addReplyBulk(c,channel);
|
addReplyBulk(c,channel);
|
||||||
else
|
else
|
||||||
addReplyNull(c);
|
addReplyNull(c, shared.nullbulk);
|
||||||
addReplyLongLong(c,clientSubscriptionsCount(c));
|
addReplyLongLong(c,clientSubscriptionsCount(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ void addReplyPubsubPatUnsubscribed(client *c, robj *pattern) {
|
|||||||
if (pattern)
|
if (pattern)
|
||||||
addReplyBulk(c,pattern);
|
addReplyBulk(c,pattern);
|
||||||
else
|
else
|
||||||
addReplyNull(c);
|
addReplyNull(c, shared.nullbulk);
|
||||||
addReplyLongLong(c,clientSubscriptionsCount(c));
|
addReplyLongLong(c,clientSubscriptionsCount(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2174,6 +2174,8 @@ void createSharedObjects(void) {
|
|||||||
shared.ok = createObject(OBJ_STRING,sdsnew("+OK\r\n"));
|
shared.ok = createObject(OBJ_STRING,sdsnew("+OK\r\n"));
|
||||||
shared.err = createObject(OBJ_STRING,sdsnew("-ERR\r\n"));
|
shared.err = createObject(OBJ_STRING,sdsnew("-ERR\r\n"));
|
||||||
shared.emptybulk = createObject(OBJ_STRING,sdsnew("$0\r\n\r\n"));
|
shared.emptybulk = createObject(OBJ_STRING,sdsnew("$0\r\n\r\n"));
|
||||||
|
shared.emptymultibulk = createObject(OBJ_STRING,sdsnew("*0\r\n"));
|
||||||
|
shared.nullbulk = createObject(OBJ_STRING,sdsnew("$0\r\n\r\n"));
|
||||||
shared.czero = createObject(OBJ_STRING,sdsnew(":0\r\n"));
|
shared.czero = createObject(OBJ_STRING,sdsnew(":0\r\n"));
|
||||||
shared.cone = createObject(OBJ_STRING,sdsnew(":1\r\n"));
|
shared.cone = createObject(OBJ_STRING,sdsnew(":1\r\n"));
|
||||||
shared.emptyarray = createObject(OBJ_STRING,sdsnew("*0\r\n"));
|
shared.emptyarray = createObject(OBJ_STRING,sdsnew("*0\r\n"));
|
||||||
|
@ -978,7 +978,7 @@ struct moduleLoadQueueEntry {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct sharedObjectsStruct {
|
struct sharedObjectsStruct {
|
||||||
robj *crlf, *ok, *err, *emptybulk, *czero, *cone, *pong, *space,
|
robj *crlf, *ok, *err, *emptybulk, *emptymultibulk, *nullbulk, *czero, *cone, *pong, *space,
|
||||||
*colon, *queued, *null[4], *nullarray[4],
|
*colon, *queued, *null[4], *nullarray[4],
|
||||||
*emptyarray, *wrongtypeerr, *nokeyerr, *syntaxerr, *sameobjecterr,
|
*emptyarray, *wrongtypeerr, *nokeyerr, *syntaxerr, *sameobjecterr,
|
||||||
*outofrangeerr, *noscripterr, *loadingerr, *slowscripterr, *bgsaveerr,
|
*outofrangeerr, *noscripterr, *loadingerr, *slowscripterr, *bgsaveerr,
|
||||||
@ -1701,7 +1701,7 @@ void acceptHandler(aeEventLoop *el, int fd, void *privdata, int mask);
|
|||||||
void acceptTcpHandler(aeEventLoop *el, int fd, void *privdata, int mask);
|
void acceptTcpHandler(aeEventLoop *el, int fd, void *privdata, int mask);
|
||||||
void acceptUnixHandler(aeEventLoop *el, int fd, void *privdata, int mask);
|
void acceptUnixHandler(aeEventLoop *el, int fd, void *privdata, int mask);
|
||||||
void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask);
|
void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask);
|
||||||
void addReplyNull(client *c);
|
void addReplyNull(client *c, robj_roptr objOldProtocol = nullptr);
|
||||||
void addReplyNullArray(client *c);
|
void addReplyNullArray(client *c);
|
||||||
void addReplyBool(client *c, int b);
|
void addReplyBool(client *c, int b);
|
||||||
void addReplyVerbatim(client *c, const char *s, size_t len, const char *ext);
|
void addReplyVerbatim(client *c, const char *s, size_t len, const char *ext);
|
||||||
|
@ -331,7 +331,7 @@ void lindexCommand(client *c) {
|
|||||||
addReplyBulk(c,value);
|
addReplyBulk(c,value);
|
||||||
decrRefCount(value);
|
decrRefCount(value);
|
||||||
} else {
|
} else {
|
||||||
addReplyNull(c);
|
addReplyNull(c,shared.nullbulk);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
serverPanic("Unknown list encoding");
|
serverPanic("Unknown list encoding");
|
||||||
@ -414,7 +414,7 @@ void lrangeCommand(client *c) {
|
|||||||
/* Invariant: start >= 0, so this test will be true when end < 0.
|
/* Invariant: start >= 0, so this test will be true when end < 0.
|
||||||
* The range is empty when start > end or start >= length. */
|
* The range is empty when start > end or start >= length. */
|
||||||
if (start > end || start >= llen) {
|
if (start > end || start >= llen) {
|
||||||
addReplyNull(c);
|
addReplyNull(c,shared.emptymultibulk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (end >= llen) end = llen-1;
|
if (end >= llen) end = llen-1;
|
||||||
|
@ -2439,7 +2439,7 @@ void zrangeGenericCommand(client *c, int reverse) {
|
|||||||
/* Invariant: start >= 0, so this test will be true when end < 0.
|
/* Invariant: start >= 0, so this test will be true when end < 0.
|
||||||
* The range is empty when start > end or start >= length. */
|
* The range is empty when start > end or start >= length. */
|
||||||
if (start > end || start >= llen) {
|
if (start > end || start >= llen) {
|
||||||
addReplyNull(c);
|
addReplyNull(c,shared.emptymultibulk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (end >= llen) end = llen-1;
|
if (end >= llen) end = llen-1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user