diff options
author | zhaozhao.zz <zhaozhao.zz@alibaba-inc.com> | 2020-06-02 11:34:28 +0800 |
---|---|---|
committer | zhaozhao.zz <zhaozhao.zz@alibaba-inc.com> | 2020-06-02 11:48:14 +0800 |
commit | ad6b71352d3ad7ef44c2b9ed850b0c3a54eea4b6 (patch) | |
tree | c5344ac1660d944f3b005f5562f132ee11865a83 | |
parent | 52e56bf70d95544a2d7f1d3c4e305ca0734d0545 (diff) | |
download | redis-ad6b71352d3ad7ef44c2b9ed850b0c3a54eea4b6.tar.gz |
donot free protected client in freeClientsInAsyncFreeQueue
related #7234
-rw-r--r-- | src/networking.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/networking.c b/src/networking.c index 8d3e057b7..cc28732d1 100644 --- a/src/networking.c +++ b/src/networking.c @@ -1239,14 +1239,20 @@ void freeClientAsync(client *c) { /* Free the clietns marked as CLOSE_ASAP, return the number of clients * freed. */ int freeClientsInAsyncFreeQueue(void) { - int freed = listLength(server.clients_to_close); - while (listLength(server.clients_to_close)) { - listNode *ln = listFirst(server.clients_to_close); + int freed = 0; + listIter li; + listNode *ln; + + listRewind(server.clients_to_close,&li); + while ((ln = listNext(&li)) != NULL) { client *c = listNodeValue(ln); + if (c->flags & CLIENT_PROTECTED) continue; + c->flags &= ~CLIENT_CLOSE_ASAP; freeClient(c); listDelNode(server.clients_to_close,ln); + freed++; } return freed; } |