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