ApiListener: Log connection attempts from an already connected client

Something is definitely going wrong if a client tries to reconnect to
this endpoint while it still has an active connection to that client. So
we shouldn't hide this, but at least log it at info level. Apart from
that, I've added some additional information about the currently active
client, such as when the last message was sent and received.
This commit is contained in:
Yonas Habteab 2024-10-30 11:26:21 +01:00
parent 09d102aeed
commit 9d4625e1ec
1 changed files with 4 additions and 2 deletions

View File

@ -843,9 +843,11 @@ void ApiListener::NewClientHandlerInternal(
Log(LogNotice, "ApiListener", "New JSON-RPC client");
if (endpoint && endpoint->GetConnected()) {
Log(LogNotice, "ApiListener")
Log(LogInformation, "ApiListener")
<< "Ignoring JSON-RPC connection " << conninfo
<< ". We're already connected to Endpoint '" << endpoint->GetName() << "'.";
<< ". We're already connected to Endpoint '" << endpoint->GetName()
<< "' (last message sent: " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", endpoint->GetLastMessageSent())
<< ", last message received: " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", endpoint->GetLastMessageReceived()) << ").";
return;
}