diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 5f981bd60..bdf387793 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -226,6 +226,7 @@ void ApiListener::AddConnection(const Endpoint::Ptr& endpoint) endpoint->SetConnecting(false); } catch (const std::exception& ex) { endpoint->SetConnecting(false); + client->Close(); std::ostringstream info, debug; info << "Cannot connect to host '" << host << "' on port '" << port << "'";