From 0ee993ddc2070f26ddef4ee50c28f9906ea3f5c7 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Wed, 16 Oct 2024 16:12:19 +1100 Subject: [PATCH] boost186 compiling --- Builds/CMake/deps/Boost.cmake | 2 +- src/ripple/app/reporting/ETLSource.cpp | 8 +++++++- src/ripple/basics/Log.h | 1 + src/ripple/basics/impl/FileUtilities.cpp | 6 ++++-- src/ripple/net/impl/DatabaseBody.ipp | 1 + src/ripple/overlay/impl/Handshake.cpp | 17 +++++++++-------- src/ripple/overlay/impl/PeerImp.cpp | 12 ++++++------ src/ripple/rpc/impl/ServerHandlerImp.cpp | 10 +++++----- src/ripple/rpc/impl/WSInfoSub.h | 2 +- src/test/app/LedgerLoad_test.cpp | 2 +- src/test/jtx/TrustedPublisherServer.h | 6 ++++-- 11 files changed, 40 insertions(+), 27 deletions(-) diff --git a/Builds/CMake/deps/Boost.cmake b/Builds/CMake/deps/Boost.cmake index ba3086c5c..5038234bc 100644 --- a/Builds/CMake/deps/Boost.cmake +++ b/Builds/CMake/deps/Boost.cmake @@ -44,7 +44,7 @@ else() endif() # TBD: # Boost_USE_DEBUG_RUNTIME: When ON, uses Boost libraries linked against the -find_package(Boost 1.70 REQUIRED +find_package(Boost 1.86 REQUIRED COMPONENTS chrono container diff --git a/src/ripple/app/reporting/ETLSource.cpp b/src/ripple/app/reporting/ETLSource.cpp index be31f4fdf..41a2b143d 100644 --- a/src/ripple/app/reporting/ETLSource.cpp +++ b/src/ripple/app/reporting/ETLSource.cpp @@ -194,8 +194,14 @@ ETLSource::onResolve( { boost::beast::get_lowest_layer(*ws_).expires_after( std::chrono::seconds(30)); + + // Use async_connect with the entire results boost::beast::get_lowest_layer(*ws_).async_connect( - results, [this](auto ec, auto ep) { onConnect(ec, ep); }); + results, + [this]( + boost::beast::error_code ec, + boost::asio::ip::tcp::resolver::results_type::endpoint_type + ep) { onConnect(ec, ep); }); } } diff --git a/src/ripple/basics/Log.h b/src/ripple/basics/Log.h index 929225c04..6722ab813 100644 --- a/src/ripple/basics/Log.h +++ b/src/ripple/basics/Log.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/src/ripple/basics/impl/FileUtilities.cpp b/src/ripple/basics/impl/FileUtilities.cpp index be60a3e5c..d94f588f1 100644 --- a/src/ripple/basics/impl/FileUtilities.cpp +++ b/src/ripple/basics/impl/FileUtilities.cpp @@ -18,6 +18,7 @@ //============================================================================== #include +#include namespace ripple { @@ -41,7 +42,7 @@ getFileContents( return {}; } - ifstream fileStream(fullPath, std::ios::in); + std::ifstream fileStream(fullPath.string(), std::ios::in); if (!fileStream) { @@ -71,7 +72,8 @@ writeFileContents( using namespace boost::filesystem; using namespace boost::system::errc; - ofstream fileStream(destPath, std::ios::out | std::ios::trunc); + std::ofstream fileStream( + destPath.string(), std::ios::out | std::ios::trunc); if (!fileStream) { diff --git a/src/ripple/net/impl/DatabaseBody.ipp b/src/ripple/net/impl/DatabaseBody.ipp index cdc7da2bc..a43b0c721 100644 --- a/src/ripple/net/impl/DatabaseBody.ipp +++ b/src/ripple/net/impl/DatabaseBody.ipp @@ -18,6 +18,7 @@ //============================================================================== #include +#include namespace ripple { diff --git a/src/ripple/overlay/impl/Handshake.cpp b/src/ripple/overlay/impl/Handshake.cpp index ebb9b2716..937570888 100644 --- a/src/ripple/overlay/impl/Handshake.cpp +++ b/src/ripple/overlay/impl/Handshake.cpp @@ -44,7 +44,7 @@ getFeatureValue( return {}; boost::smatch match; boost::regex rx(feature + "=([^;\\s]+)"); - auto const value = header->value().to_string(); + auto const value = std::string(header->value()); if (boost::regex_search(value, match, rx)) return {match[1]}; return {}; @@ -233,7 +233,7 @@ verifyHandshake( { if (auto const iter = headers.find("Server-Domain"); iter != headers.end()) { - if (!isProperlyFormedTomlDomain(iter->value().to_string())) + if (!isProperlyFormedTomlDomain(std::string(iter->value()))) throw std::runtime_error("Invalid server domain"); } @@ -243,7 +243,8 @@ verifyHandshake( uint32_t peer_nid = 0; if (auto const iter = headers.find("Network-ID"); iter != headers.end()) { - if (!beast::lexicalCastChecked(peer_nid, iter->value().to_string())) + if (!beast::lexicalCastChecked( + peer_nid, std::string(iter->value()))) throw std::runtime_error("Invalid peer network identifier"); } @@ -255,7 +256,7 @@ verifyHandshake( if (auto const iter = headers.find("Network-Time"); iter != headers.end()) { auto const netTime = - [str = iter->value().to_string()]() -> TimeKeeper::time_point { + [str = std::string(iter->value())]() -> TimeKeeper::time_point { TimeKeeper::duration::rep val; if (beast::lexicalCastChecked(val, str)) @@ -291,7 +292,7 @@ verifyHandshake( if (auto const iter = headers.find("Public-Key"); iter != headers.end()) { auto pk = parseBase58( - TokenType::NodePublic, iter->value().to_string()); + TokenType::NodePublic, std::string(iter->value())); if (pk) { @@ -317,7 +318,7 @@ verifyHandshake( if (iter == headers.end()) throw std::runtime_error("No session signature specified"); - auto sig = base64_decode(iter->value().to_string()); + auto sig = base64_decode(std::string(iter->value())); if (!verifyDigest(publicKey, sharedValue, makeSlice(sig), false)) throw std::runtime_error("Failed to verify session"); @@ -330,7 +331,7 @@ verifyHandshake( { boost::system::error_code ec; auto const local_ip = boost::asio::ip::address::from_string( - iter->value().to_string(), ec); + std::string(iter->value()), ec); if (ec) throw std::runtime_error("Invalid Local-IP"); @@ -345,7 +346,7 @@ verifyHandshake( { boost::system::error_code ec; auto const remote_ip = boost::asio::ip::address::from_string( - iter->value().to_string(), ec); + std::string(iter->value()), ec); if (ec) throw std::runtime_error("Invalid Remote-IP"); diff --git a/src/ripple/overlay/impl/PeerImp.cpp b/src/ripple/overlay/impl/PeerImp.cpp index 85844f342..adb05ddf6 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -176,7 +176,7 @@ PeerImp::run() if (auto const iter = headers_.find("Closed-Ledger"); iter != headers_.end()) { - closed = parseLedgerHash(iter->value().to_string()); + closed = parseLedgerHash(std::string(iter->value())); if (!closed) fail("Malformed handshake data (1)"); @@ -185,7 +185,7 @@ PeerImp::run() if (auto const iter = headers_.find("Previous-Ledger"); iter != headers_.end()) { - previous = parseLedgerHash(iter->value().to_string()); + previous = parseLedgerHash(std::string(iter->value())); if (!previous) fail("Malformed handshake data (2)"); @@ -372,8 +372,8 @@ std::string PeerImp::getVersion() const { if (inbound_) - return headers_["User-Agent"].to_string(); - return headers_["Server"].to_string(); + return std::string(headers_["User-Agent"]); + return std::string(headers_["Server"]); } Json::Value @@ -399,7 +399,7 @@ PeerImp::json() if (auto const d = domain(); !d.empty()) ret[jss::server_domain] = domain(); - if (auto const nid = headers_["Network-ID"].to_string(); !nid.empty()) + if (auto const nid = std::string(headers_["Network-ID"]); !nid.empty()) ret[jss::network_id] = nid; ret[jss::load] = usage_.balance(); @@ -839,7 +839,7 @@ PeerImp::name() const std::string PeerImp::domain() const { - return headers_["Server-Domain"].to_string(); + return std::string(headers_["Server-Domain"]); } //------------------------------------------------------------------------------ diff --git a/src/ripple/rpc/impl/ServerHandlerImp.cpp b/src/ripple/rpc/impl/ServerHandlerImp.cpp index f269283b8..912a0d6c3 100644 --- a/src/ripple/rpc/impl/ServerHandlerImp.cpp +++ b/src/ripple/rpc/impl/ServerHandlerImp.cpp @@ -247,11 +247,11 @@ build_map(boost::beast::http::fields const& h) std::map c; for (auto const& e : h) { - auto key(e.name_string().to_string()); + auto key(std::string(e.name_string())); std::transform(key.begin(), key.end(), key.begin(), [](auto kc) { return std::tolower(static_cast(kc)); }); - c[key] = e.value().to_string(); + c[key] = std::string(e.value()); } return c; } @@ -386,9 +386,9 @@ logDuration( beast::Journal& journal) { using namespace std::chrono_literals; - auto const level = (duration >= 10s) - ? journal.error() - : (duration >= 1s) ? journal.warn() : journal.debug(); + auto const level = (duration >= 10s) ? journal.error() + : (duration >= 1s) ? journal.warn() + : journal.debug(); JLOG(level) << "RPC request processing duration = " << std::chrono::duration_cast( diff --git a/src/ripple/rpc/impl/WSInfoSub.h b/src/ripple/rpc/impl/WSInfoSub.h index 8f386c8eb..a1f2f5bb4 100644 --- a/src/ripple/rpc/impl/WSInfoSub.h +++ b/src/ripple/rpc/impl/WSInfoSub.h @@ -50,7 +50,7 @@ public: { auto it = h.find("X-User"); if (it != h.end()) - user_ = it->value().to_string(); + user_ = std::string(it->value()); fwdfor_ = std::string(forwardedFor(h)); } } diff --git a/src/test/app/LedgerLoad_test.cpp b/src/test/app/LedgerLoad_test.cpp index 2685014e4..93fc002ae 100644 --- a/src/test/app/LedgerLoad_test.cpp +++ b/src/test/app/LedgerLoad_test.cpp @@ -154,7 +154,7 @@ class LedgerLoad_test : public beast::unit_test::suite copy_file( sd.ledgerFile, ledgerFileCorrupt, - copy_option::overwrite_if_exists, + copy_options::overwrite_existing, ec); if (!BEAST_EXPECTS(!ec, ec.message())) return; diff --git a/src/test/jtx/TrustedPublisherServer.h b/src/test/jtx/TrustedPublisherServer.h index 985c1bfd6..266f8d922 100644 --- a/src/test/jtx/TrustedPublisherServer.h +++ b/src/test/jtx/TrustedPublisherServer.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -574,7 +575,7 @@ private: if (ec) break; - auto path = req.target().to_string(); + auto path = req.target(); //.to_string(); res.insert("Server", "TrustedPublisherServer"); res.version(req.version()); res.keep_alive(req.keep_alive()); @@ -677,7 +678,8 @@ private: // unknown request res.result(boost::beast::http::status::not_found); res.insert("Content-Type", "text/html"); - res.body() = "The file '" + path + "' was not found"; + res.body() = + "The file '" + std::string(path) + "' was not found"; } if (prepare)