Merge pull request #7352 from soloestoy/donot-free-protected-client-when-blocking

donot free protected client in freeClientsInAsyncFreeQueue()
This commit is contained in:
Salvatore Sanfilippo 2020-06-08 10:43:17 +02:00 committed by GitHub
commit 4ea93c04ff

View File

@ -1239,14 +1239,20 @@ void freeClientAsync(client *c) {
/* Free the clietns marked as CLOSE_ASAP, return the number of clients /* Free the clietns marked as CLOSE_ASAP, return the number of clients
* freed. */ * freed. */
int freeClientsInAsyncFreeQueue(void) { int freeClientsInAsyncFreeQueue(void) {
int freed = listLength(server.clients_to_close); int freed = 0;
while (listLength(server.clients_to_close)) { listIter li;
listNode *ln = listFirst(server.clients_to_close); listNode *ln;
listRewind(server.clients_to_close,&li);
while ((ln = listNext(&li)) != NULL) {
client *c = listNodeValue(ln); client *c = listNodeValue(ln);
if (c->flags & CLIENT_PROTECTED) continue;
c->flags &= ~CLIENT_CLOSE_ASAP; c->flags &= ~CLIENT_CLOSE_ASAP;
freeClient(c); freeClient(c);
listDelNode(server.clients_to_close,ln); listDelNode(server.clients_to_close,ln);
freed++;
} }
return freed; return freed;
} }