Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
1a17cdfa
Commit
1a17cdfa
authored
Nov 30, 2018
by
antirez
Browse files
RESP3: addReplyNullArray() added for better RESP2 compat.
parent
86c30a92
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
1a17cdfa
...
...
@@ -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
;
...
...
src/server.h
View file @
1a17cdfa
...
...
@@ -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
readQueryFromClient
(
aeEventLoop
*
el
,
int
fd
,
void
*
privdata
,
int
mask
);
void
addReplyNull
(
client
*
c
);
void
addReplyNullArray
(
client
*
c
);
void
addReplyString
(
client
*
c
,
const
char
*
s
,
size_t
len
);
void
addReplyBulk
(
client
*
c
,
robj
*
obj
);
void
addReplyBulkCString
(
client
*
c
,
const
char
*
s
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment