ApiListener#NewClientHandlerInternal(): reject connections from already connected endpoints

This commit is contained in:
Alexander A. Klimov 2020-10-26 11:00:54 +01:00
parent e9b8fc234b
commit a530dd1b88

View File

@ -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) {