diff --git a/library/RemoteServer.cpp b/library/RemoteServer.cpp index 72f2a29b5..58a6f52ba 100644 --- a/library/RemoteServer.cpp +++ b/library/RemoteServer.cpp @@ -80,7 +80,7 @@ namespace { struct BlockedException : std::exception { const char* what() const noexcept override { - return "Core has blocked all connection. This should have been catched."; + return "Core has blocked all connection. This should have been caught."; } }; } @@ -478,23 +478,26 @@ void ServerMainImpl::threadFn(std::promise promise, int port) CActiveSocket *client = nullptr; try { - for (int acceptFail = 0 ; server.socket.IsSocketValid() && acceptFail < 5 ; acceptFail++) + for (int acceptFail = 0; server.socket.IsSocketValid() && acceptFail < 5; acceptFail++) { if ((client = server.socket.Accept()) != NULL) { BlockGuard lock; ServerConnection::Accepted(client); client = nullptr; + acceptFail = 0; } else { WARN(socket).print("Connection failure: %s (%d of %d)\n", server.socket.DescribeError(), acceptFail + 1, 5); } } - } catch(BlockedException &) { + } + catch (BlockedException&) { if (client) client->Close(); delete client; + WARN(socket).print("Connection failure: unexpectedly blocked"); } if (server.socket.IsSocketValid())