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
7d9326b1
Commit
7d9326b1
authored
May 03, 2017
by
antirez
Browse files
Modules TSC: HELLO.KEYS reply format fixed.
parent
9b01b644
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/modules/helloblock.c
View file @
7d9326b1
...
...
@@ -115,7 +115,7 @@ int HelloBlock_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int a
void
*
HelloKeys_ThreadMain
(
void
*
arg
)
{
RedisModuleBlockedClient
*
bc
=
arg
;
RedisModuleCtx
*
ctx
=
RedisModule_GetThreadSafeContext
(
bc
);
long
long
cursor
=
1
;
long
long
cursor
=
0
;
size_t
replylen
=
0
;
RedisModule_ReplyWithArray
(
ctx
,
REDISMODULE_POSTPONED_ARRAY_LEN
);
...
...
@@ -125,19 +125,21 @@ void *HelloKeys_ThreadMain(void *arg) {
"SCAN"
,
"l"
,(
long
long
)
cursor
);
RedisModule_ThreadSafeContextUnlock
(
ctx
);
size_t
items
=
RedisModule_CallReplyLength
(
reply
);
size_t
j
;
for
(
j
=
0
;
j
<
items
;
j
++
)
{
RedisModuleCallReply
*
cr_cursor
=
RedisModule_CallReplyArrayElement
(
reply
,
0
);
RedisModuleCallReply
*
cr_keys
=
RedisModule_CallReplyArrayElement
(
reply
,
1
);
RedisModuleString
*
s
=
RedisModule_CreateStringFromCallReply
(
cr_cursor
);
RedisModule_StringToLongLong
(
s
,
&
cursor
);
RedisModule_FreeString
(
ctx
,
s
);
size_t
items
=
RedisModule_CallReplyLength
(
cr_keys
);
for
(
size_t
j
=
0
;
j
<
items
;
j
++
)
{
RedisModuleCallReply
*
ele
=
RedisModule_CallReplyArrayElement
(
reply
,
j
);
if
(
j
==
0
)
{
RedisModuleString
*
s
=
RedisModule_CreateStringFromCallReply
(
ele
);
RedisModule_StringToLongLong
(
s
,
&
cursor
);
RedisModule_FreeString
(
ctx
,
s
);
}
else
{
RedisModule_ReplyWithCallReply
(
ctx
,
ele
);
replylen
++
;
}
RedisModule_CallReplyArrayElement
(
cr_keys
,
j
);
RedisModule_ReplyWithCallReply
(
ctx
,
ele
);
replylen
++
;
}
RedisModule_FreeCallReply
(
reply
);
}
while
(
cursor
!=
0
);
...
...
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