Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
726debb8
Commit
726debb8
authored
Oct 09, 2018
by
antirez
Browse files
Actually use the protectClient() API where needed.
Related to #4804.
parent
0b87f78a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/debug.c
View file @
726debb8
...
@@ -345,9 +345,9 @@ NULL
...
@@ -345,9 +345,9 @@ NULL
return
;
return
;
}
}
emptyDb
(
-
1
,
EMPTYDB_NO_FLAGS
,
NULL
);
emptyDb
(
-
1
,
EMPTYDB_NO_FLAGS
,
NULL
);
aeDeleteFileEvent
(
server
.
el
,
c
->
fd
,
AE_READABLE
);
protectClient
(
c
);
int
ret
=
rdbLoad
(
server
.
rdb_filename
,
NULL
);
int
ret
=
rdbLoad
(
server
.
rdb_filename
,
NULL
);
aeCreateFileEvent
(
server
.
el
,
c
->
fd
,
AE_READABLE
,
readQueryFrom
Client
,
c
);
unprotect
Client
(
c
);
if
(
ret
!=
C_OK
)
{
if
(
ret
!=
C_OK
)
{
addReplyError
(
c
,
"Error trying to load the RDB dump"
);
addReplyError
(
c
,
"Error trying to load the RDB dump"
);
return
;
return
;
...
@@ -357,9 +357,9 @@ NULL
...
@@ -357,9 +357,9 @@ NULL
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"loadaof"
))
{
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"loadaof"
))
{
if
(
server
.
aof_state
!=
AOF_OFF
)
flushAppendOnlyFile
(
1
);
if
(
server
.
aof_state
!=
AOF_OFF
)
flushAppendOnlyFile
(
1
);
emptyDb
(
-
1
,
EMPTYDB_NO_FLAGS
,
NULL
);
emptyDb
(
-
1
,
EMPTYDB_NO_FLAGS
,
NULL
);
aeDeleteFileEvent
(
server
.
el
,
c
->
fd
,
AE_READABLE
);
protectClient
(
c
);
int
ret
=
loadAppendOnlyFile
(
server
.
aof_filename
);
int
ret
=
loadAppendOnlyFile
(
server
.
aof_filename
);
aeCreateFileEvent
(
server
.
el
,
c
->
fd
,
AE_READABLE
,
readQueryFrom
Client
,
c
);
unprotect
Client
(
c
);
if
(
ret
!=
C_OK
)
{
if
(
ret
!=
C_OK
)
{
addReply
(
c
,
shared
.
err
);
addReply
(
c
,
shared
.
err
);
return
;
return
;
...
...
src/scripting.c
View file @
726debb8
...
@@ -1242,7 +1242,7 @@ void luaMaskCountHook(lua_State *lua, lua_Debug *ar) {
...
@@ -1242,7 +1242,7 @@ void luaMaskCountHook(lua_State *lua, lua_Debug *ar) {
* we need to mask the client executing the script from the event loop.
* we need to mask the client executing the script from the event loop.
* If we don't do that the client may disconnect and could no longer be
* If we don't do that the client may disconnect and could no longer be
* here when the EVAL command will return. */
* here when the EVAL command will return. */
aeDeleteFileEvent
(
server
.
el
,
server
.
lua_caller
->
fd
,
AE_READABLE
);
protectClient
(
server
.
lua_caller
);
}
}
if
(
server
.
lua_timedout
)
processEventsWhileBlocked
();
if
(
server
.
lua_timedout
)
processEventsWhileBlocked
();
if
(
server
.
lua_kill
)
{
if
(
server
.
lua_kill
)
{
...
@@ -1370,10 +1370,9 @@ void evalGenericCommand(client *c, int evalsha) {
...
@@ -1370,10 +1370,9 @@ void evalGenericCommand(client *c, int evalsha) {
if
(
delhook
)
lua_sethook
(
lua
,
NULL
,
0
,
0
);
/* Disable hook */
if
(
delhook
)
lua_sethook
(
lua
,
NULL
,
0
,
0
);
/* Disable hook */
if
(
server
.
lua_timedout
)
{
if
(
server
.
lua_timedout
)
{
server
.
lua_timedout
=
0
;
server
.
lua_timedout
=
0
;
/* Restore the readable handler that was unregistered when the
/* Restore the client that was protected when the script timeout
* script timeout was detected. */
* was detected. */
aeCreateFileEvent
(
server
.
el
,
c
->
fd
,
AE_READABLE
,
unprotectClient
(
c
);
readQueryFromClient
,
c
);
if
(
server
.
masterhost
&&
server
.
master
)
if
(
server
.
masterhost
&&
server
.
master
)
queueClientForReprocessing
(
server
.
master
);
queueClientForReprocessing
(
server
.
master
);
}
}
...
...
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