summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabhilashraju <abhilash.kollam@gmail.com>2025-04-24 08:24:56 +0300
committerEd Tanous <ed@tanous.net>2025-04-25 01:48:44 +0300
commit079fbcf2b237f2ca95ce2000892a9d51113a4cf5 (patch)
treebb4dd0d8868788bb40105a6188114ab90e293d3f
parentd1a3caa4eda8ca07cd656b4e4e8aa1e4ffe53e1e (diff)
downloadbmcweb-079fbcf2b237f2ca95ce2000892a9d51113a4cf5.tar.xz
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 <abhilash.kollam@gmail.com>
-rw-r--r--http/http_client.hpp4
1 files 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<ConnectionInfo>
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;