Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for boost 1.70 in load tester #2034

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions nano/load_test/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
#include <iomanip>
#include <random>

/* Boost v1.70 introduced breaking changes; the conditional compilation allows 1.6x to be supported as well. */
#if BOOST_VERSION < 107000
using socket_type = boost::asio::ip::tcp::socket;
#else
using socket_type = boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::io_context::executor_type>;
#endif

namespace nano
{
void force_nano_test_network ();
Expand Down Expand Up @@ -149,7 +156,7 @@ class receive_session final : public std::enable_shared_from_this<receive_sessio
}

private:
tcp::socket socket;
socket_type socket;
boost::asio::strand<boost::asio::io_context::executor_type> strand;
boost::beast::flat_buffer buffer;
http::request<http::string_body> req;
Expand All @@ -165,6 +172,7 @@ class send_session final : public std::enable_shared_from_this<send_session>
{
public:
send_session (boost::asio::io_context & ioc, std::atomic<int> & send_calls_remaining, std::string const & wallet, std::string const & source, std::string const & destination, tcp::resolver::results_type const & results) :
io_ctx (ioc),
socket (ioc),
strand (socket.get_executor ()),
send_calls_remaining (send_calls_remaining),
Expand Down Expand Up @@ -217,7 +225,7 @@ class send_session final : public std::enable_shared_from_this<send_session>
boost::property_tree::read_json (body, json);
auto block = json.get<std::string> ("block");

std::make_shared<receive_session> (this_l->socket.get_io_context (), this_l->send_calls_remaining, this_l->wallet, this_l->destination, block, this_l->results)->run ();
std::make_shared<receive_session> (this_l->io_ctx, this_l->send_calls_remaining, this_l->wallet, this_l->destination, block, this_l->results)->run ();

this_l->socket.shutdown (tcp::socket::shutdown_both, ec);
if (ec && ec != boost::system::errc::not_connected)
Expand All @@ -230,7 +238,8 @@ class send_session final : public std::enable_shared_from_this<send_session>
}

private:
tcp::socket socket;
boost::asio::io_context & io_ctx;
socket_type socket;
boost::asio::strand<boost::asio::io_context::executor_type> strand;
boost::beast::flat_buffer buffer;
http::request<http::string_body> req;
Expand Down