diff --git a/src/Network/TcpServer.cpp b/src/Network/TcpServer.cpp index 1b0f0d1c..9055117e 100644 --- a/src/Network/TcpServer.cpp +++ b/src/Network/TcpServer.cpp @@ -76,7 +76,7 @@ void TcpServer::setOnCreateSocket(Socket::onCreateSocket cb) { } TcpServer::Ptr TcpServer::onCreatServer(const EventPoller::Ptr &poller) { - return std::make_shared(poller); + return Ptr(new TcpServer(poller), [poller](TcpServer *ptr) { poller->async([ptr]() { delete ptr; }); }); } Socket::Ptr TcpServer::onBeforeAcceptConnection(const EventPoller::Ptr &poller) {