Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def build_requirements(self):

def requirements(self):
self.requires("secp256k1/0.22.0", transitive_headers=True, transitive_libs=True)
self.requires("boost/1.86.0", transitive_headers=True, transitive_libs=True)
self.requires("boost/1.87.0", transitive_headers=True, transitive_libs=True)
self.requires("fmt/11.0.2", transitive_headers=True, transitive_libs=True)
self.requires("expected-lite/0.8.0", transitive_headers=True, transitive_libs=True)
self.requires("ctre/3.9.0", transitive_headers=True, transitive_libs=True)
Expand Down
9 changes: 5 additions & 4 deletions include/kth/infrastructure/utility/asio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using time_point = steady_clock::time_point;
#if ! defined(__EMSCRIPTEN__)
using timer = ::asio::basic_waitable_timer<steady_clock>;

using service = ::asio::io_service;
using service = ::asio::io_context;
using address = ::asio::ip::address;
using ipv4 = ::asio::ip::address_v4;
using ipv6 = ::asio::ip::address_v6;
Expand All @@ -44,10 +44,11 @@ using endpoint = ::asio::ip::tcp::endpoint;
using socket = tcp::socket;
using acceptor = tcp::acceptor;
using resolver = tcp::resolver;
using query = tcp::resolver::query;
using iterator = tcp::resolver::iterator;
// using query = tcp::resolver::query;
// using iterator = tcp::resolver::iterator;

constexpr int max_connections = ::asio::socket_base::max_connections;
// constexpr int max_connections = ::asio::socket_base::max_connections;
constexpr int max_connections = 128;

// Boost thread is used because of thread_specific_ptr limitation:
// stackoverflow.com/q/22448022/1172329
Expand Down
3 changes: 2 additions & 1 deletion include/kth/infrastructure/utility/threadpool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ class KI_API threadpool
std::atomic<size_t> size_;
std::vector<asio::thread> threads_;
mutable upgrade_mutex threads_mutex_;
std::shared_ptr<asio::service::work> work_;
// std::shared_ptr<asio::service::work> work_;
boost::asio::executor_work_guard<boost::asio::io_context::executor_type> work_;
mutable upgrade_mutex work_mutex_;
};

Expand Down
13 changes: 11 additions & 2 deletions include/kth/infrastructure/utility/work.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ class KI_API work
template <typename Handler, typename... Args>
void concurrent(Handler&& handler, Args&&... args) {
// Service post ensures the job does not execute in the current thread.
service_.post(BIND_HANDLER(handler, args));
// service_.post(BIND_HANDLER(handler, args));
boost::asio::post(service_, BIND_HANDLER(handler, args));



////service_.post(inject(BIND_HANDLER(handler, args), CONCURRENT,
//// concurrent_));
}
Expand All @@ -72,7 +76,12 @@ class KI_API work
void unordered(Handler&& handler, Args&&... args) {
// Use a strand wrapper to prevent concurrency and a service post
// to deny ordering while ensuring execution on another thread.
service_.post(strand_.wrap(BIND_HANDLER(handler, args)));
// service_.post(strand_.wrap(BIND_HANDLER(handler, args)));

boost::asio::post(service_, boost::asio::bind_executor(strand_, BIND_HANDLER(handler, args)));



////service_.post(strand_.wrap(inject(BIND_HANDLER(handler, args),
//// UNORDERED, unordered_)));
}
Expand Down
6 changes: 4 additions & 2 deletions src/config/authority.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ static
asio::ipv6 to_ipv6(asio::ipv4 const& ipv4_address) {
// Create an IPv6 mapped IPv4 address via serialization.
auto const ipv6 = to_ipv6(ipv4_address.to_string());
return asio::ipv6::from_string(ipv6);
// return asio::ipv6::from_string(ipv6);
return boost::asio::ip::make_address_v6(ipv6);
}

static
Expand Down Expand Up @@ -236,7 +237,8 @@ std::istream& operator>>(std::istream& input, authority& argument) {
std::string ip_address = ipv6 ? ipv6.to_string() : to_ipv6(ipv4.to_string());

#if ! defined(__EMSCRIPTEN__)
argument.ip_ = asio::ipv6::from_string(ip_address);
// argument.ip_ = asio::ipv6::from_string(ip_address);
argument.ip_ = boost::asio::ip::make_address_v6(ip_address);
#endif

if (port) {
Expand Down
4 changes: 2 additions & 2 deletions src/utility/threadpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ void threadpool::spawn_once(thread_priority priority) {
if ( ! work_) {
work_mutex_.unlock_upgrade_and_lock();
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
work_ = std::make_shared<asio::service::work>(service_);

// work_ = std::make_shared<asio::service::work>(service_);
work_ = boost::asio::make_work_guard(service_);
work_mutex_.unlock_and_lock_upgrade();
//-----------------------------------------------------------------
}
Expand Down
Loading