From a530dd1b88180b5772fa81ef27646bbaaa2c37dd Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 26 Oct 2020 11:00:54 +0100 Subject: [PATCH] ApiListener#NewClientHandlerInternal(): reject connections from already connected endpoints --- lib/remote/apilistener.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 81385e6da..fbc636dc1 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -657,6 +657,13 @@ void ApiListener::NewClientHandlerInternal(boost::asio::yield_context yc, const if (ctype == ClientJsonRpc) { Log(LogNotice, "ApiListener", "New JSON-RPC client"); + if (endpoint && endpoint->GetConnected()) { + Log(LogNotice, "ApiListener") + << "Ignoring JSON-RPC connection " << conninfo + << ". We're already connected to Endpoint '" << endpoint->GetName() << "'."; + return; + } + JsonRpcConnection::Ptr aclient = new JsonRpcConnection(identity, verify_ok, client, role); if (endpoint) {