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
f2f3dc5e
Commit
f2f3dc5e
authored
Mar 18, 2020
by
Guy Benoish
Committed by
antirez
Mar 25, 2020
Browse files
Allow RM_GetContextFlags to work with ctx==NULL
parent
eb808879
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
f2f3dc5e
...
@@ -1848,20 +1848,22 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) {
...
@@ -1848,20 +1848,22 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) {
int flags = 0;
int flags = 0;
/* Client specific flags */
/* Client specific flags */
if (ctx->client) {
if (ctx) {
if (ctx->client->flags & CLIENT_LUA)
if (ctx->client) {
flags |= REDISMODULE_CTX_FLAGS_LUA;
if (ctx->client->flags & CLIENT_LUA)
if (ctx->client->flags & CLIENT_MULTI)
flags |= REDISMODULE_CTX_FLAGS_LUA;
flags |= REDISMODULE_CTX_FLAGS_MULTI;
if (ctx->client->flags & CLIENT_MULTI)
/* Module command recieved from MASTER, is replicated. */
flags |= REDISMODULE_CTX_FLAGS_MULTI;
if (ctx->client->flags & CLIENT_MASTER)
/* Module command recieved from MASTER, is replicated. */
flags |= REDISMODULE_CTX_FLAGS_REPLICATED;
if (ctx->client->flags & CLIENT_MASTER)
}
flags |= REDISMODULE_CTX_FLAGS_REPLICATED;
}
/* For DIRTY flags, we need the blocked client if used */
client *c = ctx->blocked_client ? ctx->blocked_client->client : ctx->client;
/* For DIRTY flags, we need the blocked client if used */
if (c && (c->flags & (CLIENT_DIRTY_CAS|CLIENT_DIRTY_EXEC))) {
client *c = ctx->blocked_client ? ctx->blocked_client->client : ctx->client;
flags |= REDISMODULE_CTX_FLAGS_MULTI_DIRTY;
if (c && (c->flags & (CLIENT_DIRTY_CAS|CLIENT_DIRTY_EXEC))) {
flags |= REDISMODULE_CTX_FLAGS_MULTI_DIRTY;
}
}
}
if (server.cluster_enabled)
if (server.cluster_enabled)
...
...
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