From 4144865fd8230af62b28ce535ce32ea771f98908 Mon Sep 17 00:00:00 2001 From: "isabel@lotus" Date: Wed, 24 Apr 2019 16:25:42 -0700 Subject: [PATCH] KEP-1360: fix daemon code being executed by asio system threads --- include/boost_asio_beast.hpp | 2 +- node/test/node_test_common.hpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost_asio_beast.hpp b/include/boost_asio_beast.hpp index b67b6604..36e8d2ee 100644 --- a/include/boost_asio_beast.hpp +++ b/include/boost_asio_beast.hpp @@ -300,7 +300,7 @@ namespace bzn::asio void post(bzn::asio::task func) override { - boost::asio::post(func); + boost::asio::post(this->io_context, func); } boost::asio::io_context::count_type run() override diff --git a/node/test/node_test_common.hpp b/node/test/node_test_common.hpp index f47bba3a..fcc4b568 100644 --- a/node/test/node_test_common.hpp +++ b/node/test/node_test_common.hpp @@ -63,7 +63,7 @@ namespace bzn EXPECT_CALL(*(this->io_context), post(_)).WillRepeatedly(Invoke( [&](auto func) { - this->real_io_context->post(func); + boost::asio::post(func); })); EXPECT_CALL(*(this->io_context), make_unique_steady_timer()).WillRepeatedly(Invoke( @@ -98,7 +98,7 @@ namespace bzn EXPECT_CALL(*mock_socket, async_connect(_, _)).Times(AtMost(1)).WillOnce(Invoke( [&](auto, auto handler) { - this->real_io_context->post(std::bind(handler, + boost::asio::post(std::bind(handler, this->tcp_connect_works ? boost::system::error_code{} : boost::asio::error::connection_refused)); })); @@ -163,7 +163,7 @@ namespace bzn EXPECT_CALL(*wss, async_handshake(_, _, _)).Times(AtMost(1)).WillRepeatedly(Invoke( [&](auto, auto, auto handler) { - this->real_io_context->post(std::bind(handler, boost::system::error_code{})); + boost::asio::post(std::bind(handler, boost::system::error_code{})); })); EXPECT_CALL(*wss, is_open()).WillRepeatedly(Invoke( @@ -177,7 +177,7 @@ namespace bzn [&, id](auto /*reason*/, auto handler) { this->ws_closed.insert_or_assign(id, true); - this->real_io_context->post(std::bind(handler, boost::system::error_code{})); + boost::asio::post(std::bind(handler, boost::system::error_code{})); })); EXPECT_CALL(*wss, binary(_)).Times(AnyNumber());