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
e203a46c
Commit
e203a46c
authored
Jul 11, 2017
by
antirez
Browse files
Clients blocked in modules: free argv/argc later.
See issue #3844 for more information.
parent
14c32c35
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
e203a46c
...
@@ -3304,6 +3304,11 @@ void moduleBlockedClientPipeReadable(aeEventLoop *el, int fd, void *privdata, in
...
@@ -3304,6 +3304,11 @@ void moduleBlockedClientPipeReadable(aeEventLoop *el, int fd, void *privdata, in
void
unblockClientFromModule
(
client
*
c
)
{
void
unblockClientFromModule
(
client
*
c
)
{
RedisModuleBlockedClient
*
bc
=
c
->
bpop
.
module_blocked_handle
;
RedisModuleBlockedClient
*
bc
=
c
->
bpop
.
module_blocked_handle
;
bc
->
client
=
NULL
;
bc
->
client
=
NULL
;
/* Reset the client for a new query since, for blocking commands implemented
* into modules, we do not it immediately after the command returns (and
* the client blocks) in order to be still able to access the argument
* vector from callbacks. */
resetClient
(
c
);
}
}
/* Block a client in the context of a blocking command, returning an handle
/* Block a client in the context of a blocking command, returning an handle
...
...
src/networking.c
View file @
e203a46c
...
@@ -1332,10 +1332,17 @@ void processInputBuffer(client *c) {
...
@@ -1332,10 +1332,17 @@ void processInputBuffer(client *c) {
/* Update the applied replication offset of our master. */
/* Update the applied replication offset of our master. */
c
->
reploff
=
c
->
read_reploff
-
sdslen
(
c
->
querybuf
);
c
->
reploff
=
c
->
read_reploff
-
sdslen
(
c
->
querybuf
);
}
}
resetClient
(
c
);
/* Don't reset the client structure for clients blocked in a
* module blocking command, so that the reply callback will
* still be able to access the client argv and argc field.
* The client will be reset in unblockClientFromModule(). */
if
(
!
(
c
->
flags
&
CLIENT_BLOCKED
)
||
c
->
btype
!=
BLOCKED_MODULE
)
resetClient
(
c
);
}
}
/* freeMemoryIfNeeded may flush slave output buffers. This may result
/* freeMemoryIfNeeded may flush slave output buffers. This may
* into a slave, that may be the active client, to be freed. */
* result into a slave, that may be the active client, to be
* freed. */
if
(
server
.
current_client
==
NULL
)
break
;
if
(
server
.
current_client
==
NULL
)
break
;
}
}
}
}
...
...
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