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
da0e1922
Commit
da0e1922
authored
Apr 13, 2018
by
antirez
Browse files
Modules API: moduleGetReplyClient() refactoring.
parent
404160a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
da0e1922
...
...
@@ -1003,13 +1003,21 @@ int RM_WrongArity(RedisModuleCtx *ctx) {
* The function returns the client pointer depending on the context, or
* NULL if there is no potential client. This happens when we are in the
* context of a thread safe context that was not initialized with a blocked
* client object. */
* client object. Other contexts without associated clients are the ones
* initialized to run the timers callbacks. */
client
*
moduleGetReplyClient
(
RedisModuleCtx
*
ctx
)
{
if
(
!
(
ctx
->
flags
&
REDISMODULE_CTX_THREAD_SAFE
)
&&
ctx
->
client
)
if
(
ctx
->
flags
&
REDISMODULE_CTX_THREAD_SAFE
)
{
if
(
ctx
->
blocked_client
)
return
ctx
->
blocked_client
->
reply_client
;
else
return
NULL
;
}
else
{
/* If this is a non thread safe context, just return the client
* that is running the command if any. This may be NULL as well
* in the case of contexts that are not executed with associated
* clients, like timer contexts. */
return
ctx
->
client
;
if
(
ctx
->
blocked_client
)
return
ctx
->
blocked_client
->
reply_client
;
return
NULL
;
}
}
/* Send an integer reply to the client, with the specified long long value.
...
...
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