summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-12-04 18:00:35 +0100
committerantirez <antirez@gmail.com>2018-12-21 11:42:51 +0100
commit19ed54ae1754390f50f6528ffeb198afc2813596 (patch)
tree186a4d57a5c549de1508061c3a8bd05626ed669f
parentabd82b4c6475795956c8b4747048257270cf10ef (diff)
downloadredis-19ed54ae1754390f50f6528ffeb198afc2813596.tar.gz
RESP3: addReplyBool() implemented.
-rw-r--r--src/networking.c8
-rw-r--r--src/server.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/networking.c b/src/networking.c
index 5e442e289..789ea822d 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -611,6 +611,14 @@ void addReplyNull(client *c) {
}
}
+void addReplyBool(client *c, int b) {
+ if (c->resp == 3) {
+ addReply(c, b ? shared.cone : shared.czero);
+ } else {
+ addReplyString(c, b ? "#t\r\n" : "#f\r\n",4);
+ }
+}
+
/* 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
diff --git a/src/server.h b/src/server.h
index 6a398dc3e..0362c03a2 100644
--- a/src/server.h
+++ b/src/server.h
@@ -1439,6 +1439,7 @@ 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 addReplyNullArray(client *c);
+void addReplyBool(client *c, int b);
void addReplyString(client *c, const char *s, size_t len);
void addReplyBulk(client *c, robj *obj);
void addReplyBulkCString(client *c, const char *s);