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
07329369
Commit
07329369
authored
Nov 08, 2018
by
antirez
Browse files
RESP3: Use new deferred len API in server.c.
parent
57c5a766
Changes
2
Show whitespace changes
Inline
Side-by-side
src/server.c
View file @
07329369
...
...
@@ -2940,7 +2940,7 @@ void timeCommand(client *c) {
/* gettimeofday() can only fail if &tv is a bad address so we
* don't check for errors. */
gettimeofday
(
&
tv
,
NULL
);
addReply
MultiBulk
Len
(
c
,
2
);
addReply
Array
Len
(
c
,
2
);
addReplyBulkLongLong
(
c
,
tv
.
tv_sec
);
addReplyBulkLongLong
(
c
,
tv
.
tv_usec
);
}
...
...
@@ -2960,12 +2960,12 @@ void addReplyCommand(client *c, struct redisCommand *cmd) {
addReply
(
c
,
shared
.
nullbulk
);
}
else
{
/* We are adding: command name, arg count, flags, first, last, offset */
addReply
MultiBulk
Len
(
c
,
6
);
addReply
Array
Len
(
c
,
6
);
addReplyBulkCString
(
c
,
cmd
->
name
);
addReplyLongLong
(
c
,
cmd
->
arity
);
int
flagcount
=
0
;
void
*
flaglen
=
addDeferred
MultiBulkLength
(
c
);
void
*
flaglen
=
add
Reply
Deferred
Len
(
c
);
flagcount
+=
addReplyCommandFlag
(
c
,
cmd
,
CMD_WRITE
,
"write"
);
flagcount
+=
addReplyCommandFlag
(
c
,
cmd
,
CMD_READONLY
,
"readonly"
);
flagcount
+=
addReplyCommandFlag
(
c
,
cmd
,
CMD_DENYOOM
,
"denyoom"
);
...
...
@@ -2985,7 +2985,7 @@ void addReplyCommand(client *c, struct redisCommand *cmd) {
addReplyStatus
(
c
,
"movablekeys"
);
flagcount
+=
1
;
}
setDeferred
MultiBulkLength
(
c
,
flaglen
,
flagcount
);
setDeferred
SetLen
(
c
,
flaglen
,
flagcount
);
addReplyLongLong
(
c
,
cmd
->
firstkey
);
addReplyLongLong
(
c
,
cmd
->
lastkey
);
...
...
@@ -3008,7 +3008,7 @@ NULL
};
addReplyHelp
(
c
,
help
);
}
else
if
(
c
->
argc
==
1
)
{
addReply
MultiBulk
Len
(
c
,
dictSize
(
server
.
commands
));
addReply
Array
Len
(
c
,
dictSize
(
server
.
commands
));
di
=
dictGetIterator
(
server
.
commands
);
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
addReplyCommand
(
c
,
dictGetVal
(
de
));
...
...
@@ -3016,7 +3016,7 @@ NULL
dictReleaseIterator
(
di
);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"info"
))
{
int
i
;
addReply
MultiBulk
Len
(
c
,
c
->
argc
-
2
);
addReply
Array
Len
(
c
,
c
->
argc
-
2
);
for
(
i
=
2
;
i
<
c
->
argc
;
i
++
)
{
addReplyCommand
(
c
,
dictFetchValue
(
server
.
commands
,
c
->
argv
[
i
]
->
ptr
));
}
...
...
@@ -3043,7 +3043,7 @@ NULL
if
(
!
keys
)
{
addReplyError
(
c
,
"Invalid arguments specified for command"
);
}
else
{
addReply
MultiBulk
Len
(
c
,
numkeys
);
addReply
Array
Len
(
c
,
numkeys
);
for
(
j
=
0
;
j
<
numkeys
;
j
++
)
addReplyBulk
(
c
,
c
->
argv
[
keys
[
j
]
+
2
]);
getKeysFreeResult
(
keys
);
}
...
...
src/server.h
View file @
07329369
...
...
@@ -1450,7 +1450,12 @@ void addReplyStatus(client *c, const char *status);
void
addReplyDouble
(
client
*
c
,
double
d
);
void
addReplyHumanLongDouble
(
client
*
c
,
long
double
d
);
void
addReplyLongLong
(
client
*
c
,
long
long
ll
);
void
addReplyMultiBulkLen
(
client
*
c
,
long
length
);
void
addReplyArrayLen
(
client
*
c
,
long
length
);
void
addReplyMapLen
(
client
*
c
,
long
length
);
void
addReplySetLen
(
client
*
c
,
long
length
);
void
addReplyAttributeLen
(
client
*
c
,
long
length
);
void
addReplyPushLen
(
client
*
c
,
long
length
);
void
addReplyHelloLen
(
client
*
c
,
long
length
);
void
addReplyHelp
(
client
*
c
,
const
char
**
help
);
void
addReplySubcommandSyntaxError
(
client
*
c
);
void
copyClientOutputBuffer
(
client
*
dst
,
client
*
src
);
...
...
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