From 662fdf4c04752687d0e59e5d27739ac3c0af63bf Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 6 Oct 2022 13:22:35 -0400 Subject: [PATCH] rgw: beast frontend checks for local_endpoint() errors socket.local_endpoint() throws on error. use the error_code overload instead and return on failure Fixes: https://tracker.ceph.com/issues/57784 Signed-off-by: Casey Bodley (cherry picked from commit 60af907c91210f60d0009318b8ca2ccd87941bb9) --- src/rgw/rgw_asio_frontend.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index dac47d36a7bf..0e2fec30aa6a 100644 --- a/src/rgw/rgw_asio_frontend.cc +++ b/src/rgw/rgw_asio_frontend.cc @@ -257,10 +257,14 @@ void handle_connection(boost::asio::io_context& context, ldout(cct, 1) << "failed to connect client: " << ec.message() << dendl; return; } + const auto& local_endpoint = socket.local_endpoint(ec); + if (ec) { + ldout(cct, 1) << "failed to connect client: " << ec.message() << dendl; + return; + } StreamIO real_client{cct, stream, timeout, parser, yield, buffer, - is_ssl, socket.local_endpoint(), - remote_endpoint}; + is_ssl, local_endpoint, remote_endpoint}; auto real_client_io = rgw::io::add_reordering( rgw::io::add_buffering(cct, -- 2.47.3