Skip to content

Commit f50a0a9

Browse files
authored
Merge branch 'develop' into nudbBlockSize
2 parents b4eabf3 + 1506e65 commit f50a0a9

80 files changed

Lines changed: 875 additions & 516 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/on-pr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
name: PR
66

77
on:
8+
merge_group:
9+
types:
10+
- checks_requested
811
pull_request:
912
types:
1013
- opened

.github/workflows/on-trigger.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,6 @@ jobs:
113113
os: ${{ matrix.os }}
114114
strategy_matrix: "all"
115115
secrets:
116+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
116117
conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
117118
conan_remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}

cmake/RippledSettings.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ option(beast_no_unit_test_inline
118118
"Prevents unit test definitions from being inserted into global table"
119119
OFF)
120120
option(single_io_service_thread
121-
"Restricts the number of threads calling io_service::run to one. \
121+
"Restricts the number of threads calling io_context::run to one. \
122122
This can be useful when debugging."
123123
OFF)
124124
option(boost_show_deprecated

cmake/deps/Boost.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ target_link_libraries(ripple_boost
3030
Boost::date_time
3131
Boost::filesystem
3232
Boost::json
33+
Boost::process
3334
Boost::program_options
3435
Boost::regex
3536
Boost::system

conanfile.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ def set_version(self):
100100
def configure(self):
101101
if self.settings.compiler == 'apple-clang':
102102
self.options['boost'].visibility = 'global'
103+
if self.settings.compiler in ['clang', 'gcc']:
104+
self.options['boost'].without_cobalt = True
103105

104106
def requirements(self):
105107
# Conan 2 requires transitive headers to be specified
106108
transitive_headers_opt = {'transitive_headers': True} if conan_version.split('.')[0] == '2' else {}
107-
self.requires('boost/1.86.0', force=True, **transitive_headers_opt)
109+
self.requires('boost/1.88.0', force=True, **transitive_headers_opt)
108110
self.requires('date/3.0.4', **transitive_headers_opt)
109111
self.requires('lz4/1.10.0', force=True)
110112
self.requires('protobuf/3.21.12', force=True)
@@ -175,6 +177,7 @@ def package_info(self):
175177
'boost::filesystem',
176178
'boost::json',
177179
'boost::program_options',
180+
'boost::process',
178181
'boost::regex',
179182
'boost::system',
180183
'boost::thread',

include/xrpl/basics/ResolverAsio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <xrpl/basics/Resolver.h>
2424
#include <xrpl/beast/utility/Journal.h>
2525

26-
#include <boost/asio/io_service.hpp>
26+
#include <boost/asio/io_context.hpp>
2727

2828
namespace ripple {
2929

@@ -33,7 +33,7 @@ class ResolverAsio : public Resolver
3333
explicit ResolverAsio() = default;
3434

3535
static std::unique_ptr<ResolverAsio>
36-
New(boost::asio::io_service&, beast::Journal);
36+
New(boost::asio::io_context&, beast::Journal);
3737
};
3838

3939
} // namespace ripple

include/xrpl/beast/asio/io_latency_probe.h

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#include <xrpl/beast/utility/instrumentation.h>
2424

2525
#include <boost/asio/basic_waitable_timer.hpp>
26-
#include <boost/asio/io_service.hpp>
26+
#include <boost/asio/io_context.hpp>
27+
#include <boost/asio/post.hpp>
2728

2829
#include <chrono>
2930
#include <condition_variable>
@@ -32,7 +33,7 @@
3233

3334
namespace beast {
3435

35-
/** Measures handler latency on an io_service queue. */
36+
/** Measures handler latency on an io_context queue. */
3637
template <class Clock>
3738
class io_latency_probe
3839
{
@@ -44,12 +45,12 @@ class io_latency_probe
4445
std::condition_variable_any m_cond;
4546
std::size_t m_count;
4647
duration const m_period;
47-
boost::asio::io_service& m_ios;
48+
boost::asio::io_context& m_ios;
4849
boost::asio::basic_waitable_timer<std::chrono::steady_clock> m_timer;
4950
bool m_cancel;
5051

5152
public:
52-
io_latency_probe(duration const& period, boost::asio::io_service& ios)
53+
io_latency_probe(duration const& period, boost::asio::io_context& ios)
5354
: m_count(1)
5455
, m_period(period)
5556
, m_ios(ios)
@@ -64,16 +65,16 @@ class io_latency_probe
6465
cancel(lock, true);
6566
}
6667

67-
/** Return the io_service associated with the latency probe. */
68+
/** Return the io_context associated with the latency probe. */
6869
/** @{ */
69-
boost::asio::io_service&
70-
get_io_service()
70+
boost::asio::io_context&
71+
get_io_context()
7172
{
7273
return m_ios;
7374
}
7475

75-
boost::asio::io_service const&
76-
get_io_service() const
76+
boost::asio::io_context const&
77+
get_io_context() const
7778
{
7879
return m_ios;
7980
}
@@ -109,8 +110,10 @@ class io_latency_probe
109110
std::lock_guard lock(m_mutex);
110111
if (m_cancel)
111112
throw std::logic_error("io_latency_probe is canceled");
112-
m_ios.post(sample_op<Handler>(
113-
std::forward<Handler>(handler), Clock::now(), false, this));
113+
boost::asio::post(
114+
m_ios,
115+
sample_op<Handler>(
116+
std::forward<Handler>(handler), Clock::now(), false, this));
114117
}
115118

116119
/** Initiate continuous i/o latency sampling.
@@ -124,8 +127,10 @@ class io_latency_probe
124127
std::lock_guard lock(m_mutex);
125128
if (m_cancel)
126129
throw std::logic_error("io_latency_probe is canceled");
127-
m_ios.post(sample_op<Handler>(
128-
std::forward<Handler>(handler), Clock::now(), true, this));
130+
boost::asio::post(
131+
m_ios,
132+
sample_op<Handler>(
133+
std::forward<Handler>(handler), Clock::now(), true, this));
129134
}
130135

131136
private:
@@ -236,12 +241,13 @@ class io_latency_probe
236241
// The latency is too high to maintain the desired
237242
// period so don't bother with a timer.
238243
//
239-
m_probe->m_ios.post(
244+
boost::asio::post(
245+
m_probe->m_ios,
240246
sample_op<Handler>(m_handler, now, m_repeat, m_probe));
241247
}
242248
else
243249
{
244-
m_probe->m_timer.expires_from_now(when - now);
250+
m_probe->m_timer.expires_after(when - now);
245251
m_probe->m_timer.async_wait(
246252
sample_op<Handler>(m_handler, now, m_repeat, m_probe));
247253
}
@@ -254,7 +260,8 @@ class io_latency_probe
254260
if (!m_probe)
255261
return;
256262
typename Clock::time_point const now(Clock::now());
257-
m_probe->m_ios.post(
263+
boost::asio::post(
264+
m_probe->m_ios,
258265
sample_op<Handler>(m_handler, now, m_repeat, m_probe));
259266
}
260267
};

include/xrpl/beast/test/yield_to.h

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
#ifndef BEAST_TEST_YIELD_TO_HPP
99
#define BEAST_TEST_YIELD_TO_HPP
1010

11-
#include <boost/asio/io_service.hpp>
11+
#include <boost/asio/executor_work_guard.hpp>
12+
#include <boost/asio/io_context.hpp>
1213
#include <boost/asio/spawn.hpp>
1314
#include <boost/optional.hpp>
15+
#include <boost/thread/csbl/memory/allocator_arg.hpp>
1416

1517
#include <condition_variable>
1618
#include <mutex>
@@ -29,10 +31,12 @@ namespace test {
2931
class enable_yield_to
3032
{
3133
protected:
32-
boost::asio::io_service ios_;
34+
boost::asio::io_context ios_;
3335

3436
private:
35-
boost::optional<boost::asio::io_service::work> work_;
37+
boost::optional<boost::asio::executor_work_guard<
38+
boost::asio::io_context::executor_type>>
39+
work_;
3640
std::vector<std::thread> threads_;
3741
std::mutex m_;
3842
std::condition_variable cv_;
@@ -42,7 +46,8 @@ class enable_yield_to
4246
/// The type of yield context passed to functions.
4347
using yield_context = boost::asio::yield_context;
4448

45-
explicit enable_yield_to(std::size_t concurrency = 1) : work_(ios_)
49+
explicit enable_yield_to(std::size_t concurrency = 1)
50+
: work_(boost::asio::make_work_guard(ios_))
4651
{
4752
threads_.reserve(concurrency);
4853
while (concurrency--)
@@ -56,9 +61,9 @@ class enable_yield_to
5661
t.join();
5762
}
5863

59-
/// Return the `io_service` associated with the object
60-
boost::asio::io_service&
61-
get_io_service()
64+
/// Return the `io_context` associated with the object
65+
boost::asio::io_context&
66+
get_io_context()
6267
{
6368
return ios_;
6469
}
@@ -111,13 +116,18 @@ enable_yield_to::spawn(F0&& f, FN&&... fn)
111116
{
112117
boost::asio::spawn(
113118
ios_,
119+
boost::allocator_arg,
120+
boost::context::fixedsize_stack(2 * 1024 * 1024),
114121
[&](yield_context yield) {
115122
f(yield);
116123
std::lock_guard lock{m_};
117124
if (--running_ == 0)
118125
cv_.notify_all();
119126
},
120-
boost::coroutines::attributes(2 * 1024 * 1024));
127+
[](std::exception_ptr e) {
128+
if (e)
129+
std::rethrow_exception(e);
130+
});
121131
spawn(fn...);
122132
}
123133

include/xrpl/json/json_reader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Reader::parse(Value& root, BufferSequence const& bs)
217217
std::string s;
218218
s.reserve(buffer_size(bs));
219219
for (auto const& b : bs)
220-
s.append(buffer_cast<char const*>(b), buffer_size(b));
220+
s.append(static_cast<char const*>(b.data()), buffer_size(b));
221221
return parse(s, root);
222222
}
223223

include/xrpl/net/AutoSocket.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class AutoSocket
4747

4848
public:
4949
AutoSocket(
50-
boost::asio::io_service& s,
50+
boost::asio::io_context& s,
5151
boost::asio::ssl::context& c,
5252
bool secureOnly,
5353
bool plainOnly)
@@ -58,7 +58,7 @@ class AutoSocket
5858
mSocket = std::make_unique<ssl_socket>(s, c);
5959
}
6060

61-
AutoSocket(boost::asio::io_service& s, boost::asio::ssl::context& c)
61+
AutoSocket(boost::asio::io_context& s, boost::asio::ssl::context& c)
6262
: AutoSocket(s, c, false, false)
6363
{
6464
}

0 commit comments

Comments
 (0)