fix(client): remove sockets on client destruct

This commit is contained in:
Quinten 2025-10-22 15:36:26 +02:00
parent 656abd24e7
commit 176864f35c
2 changed files with 6 additions and 2 deletions

View File

@ -35,7 +35,11 @@ Client::~Client()
{
Log::trace(LOCATION);
Log::info("Client disconnected, fd: " + std::to_string(clientSocket_->getFd()));
server_.remove(*clientSocket_);
for (auto it : sockets_)
{
server_.remove(*(it.second));
}
// server_.remove(*clientSocket_);
};
ASocket &Client::getSocket(int fd) const

View File

@ -59,8 +59,8 @@ class Client
std::unique_ptr<HttpResponse> httpResponse_;
std::unique_ptr<Router> router_;
std::unique_ptr<ClientSocket> clientSocket_;
std::unordered_map<int, ASocket *> sockets_;
std::unique_ptr<AHandler> handler_ = nullptr;
std::unordered_map<int, ASocket *> sockets_;
Server &server_;
void writeToCgi();