From aac2046e88b55513ae90c90c3fec4eee1f1961e8 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Fri, 6 Dec 2024 14:42:55 +0100 Subject: [PATCH] librbd/migration/HttpClient: don't shut down socket in resolve_host() resolve_host() is called from init() and issue() when transitioning out of STATE_UNINITIALIZED and from advance_state() right after the call to shutdown_socket(). In all three cases the socket should get closed, so drop the redundant call and place asserts in connect() implementations instead. Signed-off-by: Ilya Dryomov (cherry picked from commit 5699e4b871c66035c2c425bc9de7022fa2474c78) --- src/librbd/migration/HttpClient.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/librbd/migration/HttpClient.cc b/src/librbd/migration/HttpClient.cc index 463962befba..dbe7a16416c 100644 --- a/src/librbd/migration/HttpClient.cc +++ b/src/librbd/migration/HttpClient.cc @@ -229,7 +229,6 @@ private: auto cct = m_http_client->m_cct; ldout(cct, 15) << dendl; - shutdown_socket(); m_resolver.async_resolve( m_http_client->m_url_spec.host, m_http_client->m_url_spec.port, [this, on_finish](boost::system::error_code ec, auto results) { @@ -601,6 +600,7 @@ protected: auto cct = http_client->m_cct; ldout(cct, 15) << dendl; + ceph_assert(!m_stream.socket().is_open()); m_stream.async_connect( results, [on_finish](boost::system::error_code ec, const auto& endpoint) { @@ -645,6 +645,7 @@ protected: auto cct = http_client->m_cct; ldout(cct, 15) << dendl; + ceph_assert(!boost::beast::get_lowest_layer(m_stream).socket().is_open()); boost::beast::get_lowest_layer(m_stream).async_connect( results, [this, on_finish](boost::system::error_code ec, const auto& endpoint) { -- 2.39.5