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
2214043b
Commit
2214043b
authored
Jun 27, 2018
by
antirez
Browse files
CLIENT UNBLOCK: support unblocking by error.
parent
71295ee3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
2214043b
...
...
@@ -1688,14 +1688,33 @@ NULL
/* If this client has to be closed, flag it as CLOSE_AFTER_REPLY
* only after we queued the reply to its output buffers. */
if
(
close_this_client
)
c
->
flags
|=
CLIENT_CLOSE_AFTER_REPLY
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"unblock"
)
&&
c
->
argc
==
3
)
{
/* CLIENT UNBLOCK <id> */
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"unblock"
)
&&
(
c
->
argc
==
3
||
c
->
argc
==
4
))
{
/* CLIENT UNBLOCK <id> [timeout|error] */
long
long
id
;
int
unblock_error
=
0
;
if
(
c
->
argc
==
4
)
{
if
(
!
strcasecmp
(
c
->
argv
[
3
]
->
ptr
,
"timeout"
))
{
unblock_error
=
0
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
3
]
->
ptr
,
"error"
))
{
unblock_error
=
1
;
}
else
{
addReplyError
(
c
,
"CLIENT UNBLOCK reason should be TIMEOUT or ERROR"
);
return
;
}
}
if
(
getLongLongFromObjectOrReply
(
c
,
c
->
argv
[
2
],
&
id
,
NULL
)
!=
C_OK
)
return
;
struct
client
*
target
=
lookupClientByID
(
id
);
if
(
target
&&
target
->
flags
&
CLIENT_BLOCKED
)
{
replyToBlockedClientTimedOut
(
target
);
if
(
unblock_error
)
addReplyError
(
target
,
"-UNBLOCKED client unblocked via CLIENT UNBLOCK"
);
else
replyToBlockedClientTimedOut
(
target
);
unblockClient
(
target
);
addReply
(
c
,
shared
.
cone
);
}
else
{
...
...
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