diff --git a/REST/Server.cc b/REST/Server.cc index 045dece29..2365bc639 100644 --- a/REST/Server.cc +++ b/REST/Server.cc @@ -169,8 +169,15 @@ namespace litecore::REST { void Server::handleConnection(sockpp::stream_socket&& sock) { auto responder = make_unique(_tlsContext); if ( !responder->acceptSocket(std::move(sock)) || (_tlsContext && !responder->wrapTLS()) ) { - c4log(ListenerLog, kC4LogError, "Error accepting incoming connection: %s", - responder->error().description().c_str()); + C4Error error = responder->error(); + string description = error.description(); + if (error.domain == NetworkDomain) { + // The default messages call the peer "server" and me "client"; reverse that: + replace(description, "server", "CLIENT"); + replace(description, "client", "server"); + replace(description, "CLIENT", "client"); + } + c4log(ListenerLog, kC4LogError, "Error accepting incoming connection: %s", description.c_str()); return; }