fix so failed accept doesn't terminate the server

Signed-off-by: Kent Gustavsson <kent@minoris.se>
develop
Kent Gustavsson 2023-06-25 14:43:08 +02:00
parent d9d0482386
commit dfd453ae05
1 changed files with 7 additions and 4 deletions

@ -476,12 +476,15 @@ void ServerMainImpl::threadFn(std::promise<bool> promise, int port)
CActiveSocket *client = nullptr;
try {
while ((client = server.socket.Accept()) != NULL)
while (server.socket.IsSocketValid())
{
if ((client = server.socket.Accept()) != NULL)
{
BlockGuard lock;
ServerConnection::Accepted(client);
client = nullptr;
}
}
} catch(BlockedException &) {
if (client)
client->Close();