From ace6ed294183b2988d1e4b39361c40356e966e83 Mon Sep 17 00:00:00 2001 From: fortrue Date: Sat, 15 Jun 2019 09:03:54 +0800 Subject: [PATCH] fix private connection leak --- src/Handler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Handler.cpp b/src/Handler.cpp index b29bdf4..b45127b 100644 --- a/src/Handler.cpp +++ b/src/Handler.cpp @@ -215,7 +215,6 @@ void Handler::postAcceptConnectionEvent() auto cp = mConnPool[s->server()->id()]; s->setStatus(Connection::LogicError); addPostEvent(s, Multiplexor::ErrorEvent); - cp->putPrivateConnection(s); c->detachConnectConnection(); s->detachAcceptConnection(); } @@ -276,6 +275,9 @@ void Handler::postConnectConnectionEvent() s->status(), s->statusStr()); mEventLoop->delSocket(s); s->close(this); + if (!s->isShared()) { + mConnPool[s->server()->id()]->putPrivateConnection(s); + } if (c) { addPostEvent(c, Multiplexor::ErrorEvent); s->detachAcceptConnection();