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