From 9d4625e1ece2e02dd0158bfe2bcb5f7a5d8751b2 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Wed, 30 Oct 2024 11:26:21 +0100 Subject: [PATCH] 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. --- lib/remote/apilistener.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 7884131c46f..cc9c3b5c820 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -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; }