20#ifndef RIPPLE_PEERFINDER_CHECKER_H_INCLUDED
21#define RIPPLE_PEERFINDER_CHECKER_H_INCLUDED
23#include <xrpl/beast/net/IPAddressConversion.h>
25#include <boost/asio/io_context.hpp>
26#include <boost/asio/ip/tcp.hpp>
27#include <boost/intrusive/list.hpp>
37template <
class Protocol = boost::asio::ip::tcp>
44 : boost::intrusive::list_base_hook<
45 boost::intrusive::link_mode<boost::intrusive::normal_link>>
56 template <
class Handler>
68 boost::asio::io_context& io_context,
82 using list_type =
typename boost::intrusive::make_list<
84 boost::intrusive::constant_time_size<true>>::type;
93 explicit Checker(boost::asio::io_context& io_context);
120 template <
class Handler>
131template <
class Protocol>
132template <
class Handler>
135 boost::asio::io_context& io_context,
138 , socket_(io_context)
143template <
class Protocol>
144template <
class Handler>
150template <
class Protocol>
151template <
class Handler>
159template <
class Protocol>
160template <
class Handler>
169template <
class Protocol>
175template <
class Protocol>
181template <
class Protocol>
189 for (
auto& c : list_)
194template <
class Protocol>
199 while (!list_.empty())
203template <
class Protocol>
204template <
class Handler>
214 list_.push_back(*op);
216 op->socket_.async_connect(
218 std::bind(&basic_async_op::operator(), op, std::placeholders::_1));
221template <
class Protocol>
226 list_.erase(list_.iterator_to(op));
227 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