From 0a1d2c99ac0b93d0058a402856e62c89cfb5d227 Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 24 May 2020 12:46:11 -0400 Subject: [PATCH] don't keep feeding data to clients pending close Former-commit-id: 4db3f2a443a6f71d1486781005ee37546e89d6e1 --- src/replication.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/replication.cpp b/src/replication.cpp index 6b18d27ac..599c82030 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -1458,6 +1458,9 @@ void rdbPipeReadHandler(struct aeEventLoop *eventLoop, int fd, void *clientData, client *slave = (client*)connGetPrivateData(conn); std::unique_lock ul(slave->lock); + if(slave->flags.load(std::memory_order_relaxed) & CLIENT_CLOSE_ASAP) + continue; // if we asked to free the client don't send any more data + // Normally it would be bug to talk a client conn from a different thread, but here we know nobody else will // be sending anything while in this replication state so it is OK if ((nwritten = connWrite(conn, g_pserver->rdb_pipe_buff, g_pserver->rdb_pipe_bufflen)) == -1) {