Skip to content

Commit

Permalink
ApiListener: Log connection attempts from an already connected client
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yhabteab committed Oct 30, 2024
1 parent 09d102a commit 9d4625e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/remote/apilistener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 9d4625e

Please sign in to comment.