mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
refactor: Update to Boost 1.88 (#5570)
This updates Boost to 1.88, which is needed because Clio wants to move to 1.88 as that fixes several ASAN false positives around coroutine usage. In order for Clio to move to newer boost, libXRPL needs to move too. Hence the changes in this PR. A lot has changed between 1.83 and 1.88 so there are lots of changes in the diff, especially in regards to Boost.Asio and coroutines in particular.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <boost/beast/http.hpp>
|
||||
@@ -165,12 +166,11 @@ class ServerStatus_test : public beast::unit_test::suite,
|
||||
{
|
||||
using namespace boost::asio;
|
||||
using namespace boost::beast::http;
|
||||
io_service& ios = get_io_service();
|
||||
io_context& ios = get_io_context();
|
||||
ip::tcp::resolver r{ios};
|
||||
boost::beast::multi_buffer sb;
|
||||
|
||||
auto it = r.async_resolve(
|
||||
ip::tcp::resolver::query{host, std::to_string(port)}, yield[ec]);
|
||||
auto it = r.async_resolve(host, std::to_string(port), yield[ec]);
|
||||
if (ec)
|
||||
return;
|
||||
|
||||
@@ -476,12 +476,11 @@ class ServerStatus_test : public beast::unit_test::suite,
|
||||
auto req_string = boost::lexical_cast<std::string>(req);
|
||||
req_string.erase(req_string.find_last_of("13"), std::string::npos);
|
||||
|
||||
io_service& ios = get_io_service();
|
||||
io_context& ios = get_io_context();
|
||||
ip::tcp::resolver r{ios};
|
||||
boost::beast::multi_buffer sb;
|
||||
|
||||
auto it = r.async_resolve(
|
||||
ip::tcp::resolver::query{*ip, std::to_string(*port)}, yield[ec]);
|
||||
auto it = r.async_resolve(*ip, std::to_string(*port), yield[ec]);
|
||||
if (!BEAST_EXPECTS(!ec, ec.message()))
|
||||
return;
|
||||
|
||||
@@ -610,14 +609,13 @@ class ServerStatus_test : public beast::unit_test::suite,
|
||||
env.app().config()["port_rpc"].get<std::string>("ip").value();
|
||||
|
||||
boost::system::error_code ec;
|
||||
io_service& ios = get_io_service();
|
||||
io_context& ios = get_io_context();
|
||||
ip::tcp::resolver r{ios};
|
||||
|
||||
Json::Value jr;
|
||||
jr[jss::method] = "server_info";
|
||||
|
||||
auto it = r.async_resolve(
|
||||
ip::tcp::resolver::query{ip, std::to_string(port)}, yield[ec]);
|
||||
auto it = r.async_resolve(ip, std::to_string(port), yield[ec]);
|
||||
BEAST_EXPECT(!ec);
|
||||
|
||||
std::vector<std::pair<ip::tcp::socket, boost::beast::multi_buffer>>
|
||||
@@ -681,7 +679,7 @@ class ServerStatus_test : public beast::unit_test::suite,
|
||||
resp["Upgrade"] == "websocket");
|
||||
BEAST_EXPECT(
|
||||
resp.find("Connection") != resp.end() &&
|
||||
resp["Connection"] == "Upgrade");
|
||||
boost::iequals(resp["Connection"], "upgrade"));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -728,11 +726,10 @@ class ServerStatus_test : public beast::unit_test::suite,
|
||||
env.app().config()["port_ws"].get<std::string>("ip").value();
|
||||
boost::system::error_code ec;
|
||||
|
||||
io_service& ios = get_io_service();
|
||||
io_context& ios = get_io_context();
|
||||
ip::tcp::resolver r{ios};
|
||||
|
||||
auto it = r.async_resolve(
|
||||
ip::tcp::resolver::query{ip, std::to_string(port)}, yield[ec]);
|
||||
auto it = r.async_resolve(ip, std::to_string(port), yield[ec]);
|
||||
if (!BEAST_EXPECT(!ec))
|
||||
return;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <xrpl/server/Session.h>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/executor_work_guard.hpp>
|
||||
#include <boost/beast/core/tcp_stream.hpp>
|
||||
#include <boost/beast/ssl/ssl_stream.hpp>
|
||||
#include <boost/utility/in_place_factory.hpp>
|
||||
@@ -52,14 +53,16 @@ public:
|
||||
class TestThread
|
||||
{
|
||||
private:
|
||||
boost::asio::io_service io_service_;
|
||||
std::optional<boost::asio::io_service::work> work_;
|
||||
boost::asio::io_context io_context_;
|
||||
std::optional<boost::asio::executor_work_guard<
|
||||
boost::asio::io_context::executor_type>>
|
||||
work_;
|
||||
std::thread thread_;
|
||||
|
||||
public:
|
||||
TestThread()
|
||||
: work_(std::in_place, std::ref(io_service_))
|
||||
, thread_([&]() { this->io_service_.run(); })
|
||||
: work_(std::in_place, boost::asio::make_work_guard(io_context_))
|
||||
, thread_([&]() { this->io_context_.run(); })
|
||||
{
|
||||
}
|
||||
|
||||
@@ -69,10 +72,10 @@ public:
|
||||
thread_.join();
|
||||
}
|
||||
|
||||
boost::asio::io_service&
|
||||
get_io_service()
|
||||
boost::asio::io_context&
|
||||
get_io_context()
|
||||
{
|
||||
return io_service_;
|
||||
return io_context_;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -234,7 +237,7 @@ public:
|
||||
void
|
||||
test_request(boost::asio::ip::tcp::endpoint const& ep)
|
||||
{
|
||||
boost::asio::io_service ios;
|
||||
boost::asio::io_context ios;
|
||||
using socket = boost::asio::ip::tcp::socket;
|
||||
socket s(ios);
|
||||
|
||||
@@ -260,7 +263,7 @@ public:
|
||||
void
|
||||
test_keepalive(boost::asio::ip::tcp::endpoint const& ep)
|
||||
{
|
||||
boost::asio::io_service ios;
|
||||
boost::asio::io_context ios;
|
||||
using socket = boost::asio::ip::tcp::socket;
|
||||
socket s(ios);
|
||||
|
||||
@@ -300,10 +303,10 @@ public:
|
||||
sink.threshold(beast::severities::Severity::kAll);
|
||||
beast::Journal journal{sink};
|
||||
TestHandler handler;
|
||||
auto s = make_Server(handler, thread.get_io_service(), journal);
|
||||
auto s = make_Server(handler, thread.get_io_context(), journal);
|
||||
std::vector<Port> serverPort(1);
|
||||
serverPort.back().ip =
|
||||
beast::IP::Address::from_string(getEnvLocalhostAddr()),
|
||||
boost::asio::ip::make_address(getEnvLocalhostAddr()),
|
||||
serverPort.back().port = 0;
|
||||
serverPort.back().protocol.insert("http");
|
||||
auto eps = s->ports(serverPort);
|
||||
@@ -375,10 +378,10 @@ public:
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
{
|
||||
TestThread thread;
|
||||
auto s = make_Server(h, thread.get_io_service(), journal);
|
||||
auto s = make_Server(h, thread.get_io_context(), journal);
|
||||
std::vector<Port> serverPort(1);
|
||||
serverPort.back().ip =
|
||||
beast::IP::Address::from_string(getEnvLocalhostAddr()),
|
||||
boost::asio::ip::make_address(getEnvLocalhostAddr()),
|
||||
serverPort.back().port = 0;
|
||||
serverPort.back().protocol.insert("http");
|
||||
s->ports(serverPort);
|
||||
|
||||
Reference in New Issue
Block a user