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; CActiveSocket *client = nullptr;
try { try {
while ((client = server.socket.Accept()) != NULL) while (server.socket.IsSocketValid())
{ {
BlockGuard lock; if ((client = server.socket.Accept()) != NULL)
ServerConnection::Accepted(client); {
client = nullptr; BlockGuard lock;
ServerConnection::Accepted(client);
client = nullptr;
}
} }
} catch(BlockedException &) { } catch(BlockedException &) {
if (client) if (client)