1#ifndef XRPL_PEERFINDER_CHECKER_H_INCLUDED
2#define XRPL_PEERFINDER_CHECKER_H_INCLUDED
4#include <xrpl/beast/net/IPAddressConversion.h>
6#include <boost/asio/io_context.hpp>
7#include <boost/asio/ip/tcp.hpp>
8#include <boost/intrusive/list.hpp>
18template <
class Protocol = boost::asio::ip::tcp>
25 : boost::intrusive::list_base_hook<
26 boost::intrusive::link_mode<boost::intrusive::normal_link>>
37 template <
class Handler>
49 boost::asio::io_context& io_context,
63 using list_type =
typename boost::intrusive::make_list<
65 boost::intrusive::constant_time_size<true>>::type;
74 explicit Checker(boost::asio::io_context& io_context);
101 template <
class Handler>
112template <
class Protocol>
113template <
class Handler>
116 boost::asio::io_context& io_context,
119 , socket_(io_context)
124template <
class Protocol>
125template <
class Handler>
131template <
class Protocol>
132template <
class Handler>
140template <
class Protocol>
141template <
class Handler>
150template <
class Protocol>
156template <
class Protocol>
162template <
class Protocol>
170 for (
auto& c : list_)
175template <
class Protocol>
180 while (!list_.empty())
184template <
class Protocol>
185template <
class Handler>
195 list_.push_back(*op);
197 op->socket_.async_connect(
199 std::bind(&basic_async_op::operator(), op, std::placeholders::_1));
202template <
class Protocol>
207 list_.erase(list_.iterator_to(op));
208 if (list_.size() == 0)
A version-independent IP address and port combination.
Tests remote listening sockets to make sure they are connectible.
boost::asio::io_context & io_context_
boost::system::error_code error_code
void remove(basic_async_op &op)
std::condition_variable cond_
void stop()
Stop the service.
~Checker()
Destroy the service.
void async_connect(beast::IP::Endpoint const &endpoint, Handler &&handler)
Performs an async connection test on the specified endpoint.
typename boost::intrusive::make_list< basic_async_op, boost::intrusive::constant_time_size< true > >::type list_type
void wait()
Block until all pending I/O completes.
Checker(boost::asio::io_context &io_context)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static boost::asio::ip::tcp::endpoint to_asio_endpoint(IP::Endpoint const &address)
void operator()(error_code const &ec) override
typename Protocol::endpoint endpoint_type
typename Protocol::socket socket_type
virtual void operator()(error_code const &ec)=0
virtual ~basic_async_op()=default