mirror of
https://github.com/fluencelabs/redis
synced 2025-04-03 08:11:03 +00:00
RESP3: addReplyNullArray() added for better RESP2 compat.
This commit is contained in:
parent
86c30a92f9
commit
1a17cdfadf
@ -611,6 +611,18 @@ void addReplyNull(client *c) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A null array is a concept that no longer exists in RESP3. However
|
||||||
|
* RESP2 had it, so API-wise we have this call, that will emit the correct
|
||||||
|
* RESP2 protocol, however for RESP3 the reply will always be just the
|
||||||
|
* Null type "_\r\n". */
|
||||||
|
void addReplyNullArray(client *c) {
|
||||||
|
if (c->resp == 2) {
|
||||||
|
addReplyString(c,"*-1\r\n",5);
|
||||||
|
} else {
|
||||||
|
addReplyString(c,"_\r\n",3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the length prefix of a bulk reply, example: $2234 */
|
/* Create the length prefix of a bulk reply, example: $2234 */
|
||||||
void addReplyBulkLen(client *c, robj *obj) {
|
void addReplyBulkLen(client *c, robj *obj) {
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -1438,6 +1438,7 @@ 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);
|
||||||
|
void addReplyNullArray(client *c);
|
||||||
void addReplyString(client *c, const char *s, size_t len);
|
void addReplyString(client *c, const char *s, size_t len);
|
||||||
void addReplyBulk(client *c, robj *obj);
|
void addReplyBulk(client *c, robj *obj);
|
||||||
void addReplyBulkCString(client *c, const char *s);
|
void addReplyBulkCString(client *c, const char *s);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user