From 079fbcf2b237f2ca95ce2000892a9d51113a4cf5 Mon Sep 17 00:00:00 2001 From: abhilashraju Date: Thu, 24 Apr 2025 05:24:56 +0000 Subject: http_client: Fixing invalid log The error log for connection failures previously displayed an invalid host name and port number because it retrieved these values from the endpoint argument in the afterConnect callback, which is not valid when the connection fails. This patch resolves the issue by obtaining the host name directly from the connection object. Tested By: Attempted to subscribe to an unreachable host and sent test events to verify that the error log was generated as expected. Change-Id: I33772b224eb7ab164c2de342f35ae42c34126b3d Signed-off-by: Abhilash Raju --- http/http_client.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp index 6e5613bd69..cb6702298b 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -219,8 +219,8 @@ class ConnectionInfo : public std::enable_shared_from_this if (ec) { BMCWEB_LOG_ERROR("Connect {}:{}, id: {} failed: {}", - endpoint.address().to_string(), endpoint.port(), - connId, ec.message()); + host.encoded_host_address(), host.port(), connId, + ec.message()); state = ConnState::connectFailed; waitAndRetry(); return; -- cgit v1.2.3