Prevent dangling lock when we can't free the client

Former-commit-id: 3c373494d63b21744b264f0a47e6999bcdda6b2b
This commit is contained in:
John Sully 2020-03-19 14:34:23 -04:00
parent 591cc30206
commit 96be5f6a6c

View File

@ -1630,10 +1630,13 @@ void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) {
if (writeToClient(fd,c,1) == C_ERR) if (writeToClient(fd,c,1) == C_ERR)
{ {
AeLocker ae; AeLocker ae;
c->lock.lock(); c->lock();
ae.arm(c); ae.arm(c);
if (c->flags & CLIENT_CLOSE_ASAP) if (c->flags & CLIENT_CLOSE_ASAP)
freeClient(c); {
if (!freeClient(c))
c->unlock();
}
} }
} }