RESP3: addReplyNullArray() added for better RESP2 compat.

This commit is contained in:
antirez
2018-11-30 16:31:02 +01:00
parent 86c30a92f9
commit 1a17cdfadf
2 changed files with 13 additions and 0 deletions

View File

@ -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 */
void addReplyBulkLen(client *c, robj *obj) {
size_t len;