提交 e06b3819 编写于 作者: A antirez

CLIENT KILL: fix closing link of the current client.

上级 e7affd26
...@@ -1357,6 +1357,7 @@ void clientCommand(redisClient *c) { ...@@ -1357,6 +1357,7 @@ void clientCommand(redisClient *c) {
int type = -1; int type = -1;
uint64_t id = 0; uint64_t id = 0;
int killed = 0; int killed = 0;
int close_this_client = 0;
/* Parse arguments. */ /* Parse arguments. */
if (c->argc == 3) { if (c->argc == 3) {
...@@ -1396,7 +1397,7 @@ void clientCommand(redisClient *c) { ...@@ -1396,7 +1397,7 @@ void clientCommand(redisClient *c) {
/* Kill it. */ /* Kill it. */
if (c == client) { if (c == client) {
client->flags |= REDIS_CLOSE_AFTER_REPLY; close_this_client = 1;
} else { } else {
freeClient(client); freeClient(client);
} }
...@@ -1412,6 +1413,10 @@ void clientCommand(redisClient *c) { ...@@ -1412,6 +1413,10 @@ void clientCommand(redisClient *c) {
} else { } else {
addReplyLongLong(c,killed); addReplyLongLong(c,killed);
} }
/* 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 |= REDIS_CLOSE_AFTER_REPLY;
} else if (!strcasecmp(c->argv[1]->ptr,"setname") && c->argc == 3) { } else if (!strcasecmp(c->argv[1]->ptr,"setname") && c->argc == 3) {
int j, len = sdslen(c->argv[2]->ptr); int j, len = sdslen(c->argv[2]->ptr);
char *p = c->argv[2]->ptr; char *p = c->argv[2]->ptr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册