Skip to content

Commit

Permalink
Ensure thread safety for TcpServer's deconstruction (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-chu committed Dec 31, 2023
1 parent 04f761e commit 0dbf6c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Network/TcpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void TcpServer::setOnCreateSocket(Socket::onCreateSocket cb) {
}

TcpServer::Ptr TcpServer::onCreatServer(const EventPoller::Ptr &poller) {
return std::make_shared<TcpServer>(poller);
return Ptr(new TcpServer(poller), [poller](TcpServer *ptr) { poller->async([ptr]() { delete ptr; }); });
}

Socket::Ptr TcpServer::onBeforeAcceptConnection(const EventPoller::Ptr &poller) {
Expand Down

0 comments on commit 0dbf6c8

Please sign in to comment.