From 101e419ffc5a62617d88cf7b218e3581579c3202 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 9 Oct 2018 13:25:53 +0200 Subject: [PATCH] Free protected clients asynchronously. Related to #4840. Note that when we re-enter the event loop with aeProcessEvents() we don't process timers, nor before/after sleep callbacks, so we should never end calling freeClientsInAsyncFreeQueue() when re-entering the loop. --- src/networking.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/networking.c b/src/networking.c index abce50bb..98a4f24e 100644 --- a/src/networking.c +++ b/src/networking.c @@ -829,6 +829,13 @@ void unlinkClient(client *c) { void freeClient(client *c) { listNode *ln; + /* If a client is protected, yet we need to free it right now, make sure + * to at least use asynchronous freeing. */ + if (c->flags & CLIENT_PROTECTED) { + freeClientAsync(c); + return; + } + /* If it is our master that's beging disconnected we should make sure * to cache the state to try a partial resynchronization later. *