Merge pull request #101 from joyieldInc/FixPrivateConnLeak

fix private connection leak
This commit is contained in:
fortrue 2020-02-01 15:24:14 +08:00 committed by GitHub
commit 393ff81e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,7 +215,6 @@ void Handler::postAcceptConnectionEvent()
auto cp = mConnPool[s->server()->id()]; auto cp = mConnPool[s->server()->id()];
s->setStatus(Connection::LogicError); s->setStatus(Connection::LogicError);
addPostEvent(s, Multiplexor::ErrorEvent); addPostEvent(s, Multiplexor::ErrorEvent);
cp->putPrivateConnection(s);
c->detachConnectConnection(); c->detachConnectConnection();
s->detachAcceptConnection(); s->detachAcceptConnection();
} }
@ -276,6 +275,9 @@ void Handler::postConnectConnectionEvent()
s->status(), s->statusStr()); s->status(), s->statusStr());
mEventLoop->delSocket(s); mEventLoop->delSocket(s);
s->close(this); s->close(this);
if (!s->isShared()) {
mConnPool[s->server()->id()]->putPrivateConnection(s);
}
if (c) { if (c) {
addPostEvent(c, Multiplexor::ErrorEvent); addPostEvent(c, Multiplexor::ErrorEvent);
s->detachAcceptConnection(); s->detachAcceptConnection();