fix: delete client, if he empty

This commit is contained in:
Talyx
2022-02-01 17:39:45 +03:00
parent d63e122778
commit f8343098e8
4 changed files with 19 additions and 5 deletions

View File

@@ -154,7 +154,7 @@ void Server::start(void)
std::cout << TURQ << "IN SEND LOOP" << RESET << std::endl;
Client &client = client_it->second;
if (!client.allRead)
if (!client.allRead && !client.isEmpty())
{
readSocket(client_it->first, client_map);
}
@@ -168,7 +168,7 @@ void Server::start(void)
}
if (client.readyToSend() && client.allSended())
if ((client.readyToSend() && client.allSended()) || client.isEmpty())
{
client_map[fd].printClientInfo();
close(client_it->first);