Skip to content

Commit 4846c0c

Browse files
soloestoyantirez
authored andcommitted
donot free protected client in freeClientsInAsyncFreeQueue
related #7234
1 parent f33de40 commit 4846c0c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/networking.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,14 +1239,20 @@ void freeClientAsync(client *c) {
12391239
/* Free the clietns marked as CLOSE_ASAP, return the number of clients
12401240
* freed. */
12411241
int freeClientsInAsyncFreeQueue(void) {
1242-
int freed = listLength(server.clients_to_close);
1243-
while (listLength(server.clients_to_close)) {
1244-
listNode *ln = listFirst(server.clients_to_close);
1242+
int freed = 0;
1243+
listIter li;
1244+
listNode *ln;
1245+
1246+
listRewind(server.clients_to_close,&li);
1247+
while ((ln = listNext(&li)) != NULL) {
12451248
client *c = listNodeValue(ln);
12461249

1250+
if (c->flags & CLIENT_PROTECTED) continue;
1251+
12471252
c->flags &= ~CLIENT_CLOSE_ASAP;
12481253
freeClient(c);
12491254
listDelNode(server.clients_to_close,ln);
1255+
freed++;
12501256
}
12511257
return freed;
12521258
}

0 commit comments

Comments
 (0)