xrpld
Loading...
Searching...
No Matches
xrpl::PeerFinder::Checker< Protocol > Class Template Reference

Tests remote listening sockets to make sure they are connectable. More...

#include <Checker.h>

Collaboration diagram for xrpl::PeerFinder::Checker< Protocol >:

Classes

struct  BasicAsyncOp
struct  AsyncOp

Public Member Functions

 Checker (boost::asio::io_context &ioContext)
 ~Checker ()
 Destroy the service.
void stop ()
 Stop the service.
void wait ()
 Block until all pending I/O completes.
template<class Handler>
void asyncConnect (beast::IP::Endpoint const &endpoint, Handler &&handler)
 Performs an async connection test on the specified endpoint.

Private Types

using error_code = boost::system::error_code
using list_type

Private Member Functions

void remove (BasicAsyncOp &op)

Private Attributes

std::mutex mutex_
std::condition_variable cond_
boost::asio::io_context & ioContext_
list_type list_
bool stop_ = false

Detailed Description

template<class Protocol = boost::asio::ip::tcp>
class xrpl::PeerFinder::Checker< Protocol >

Tests remote listening sockets to make sure they are connectable.

Definition at line 17 of file Checker.h.

Member Typedef Documentation

◆ error_code

template<class Protocol = boost::asio::ip::tcp>
using xrpl::PeerFinder::Checker< Protocol >::error_code = boost::system::error_code
private

Definition at line 20 of file Checker.h.

◆ list_type

template<class Protocol = boost::asio::ip::tcp>
using xrpl::PeerFinder::Checker< Protocol >::list_type
private
Initial value:
boost::intrusive::make_list<BasicAsyncOp, boost::intrusive::constant_time_size<true>>::type

Definition at line 60 of file Checker.h.

Constructor & Destructor Documentation

◆ Checker()

template<class Protocol>
xrpl::PeerFinder::Checker< Protocol >::Checker ( boost::asio::io_context & ioContext)
explicit

Definition at line 139 of file Checker.h.

◆ ~Checker()

template<class Protocol>
xrpl::PeerFinder::Checker< Protocol >::~Checker ( )

Destroy the service.

Any pending I/O operations will be canceled. This call blocks until all pending operations complete (either with success or with operation_aborted) and the associated thread and io_context have no more work remaining.

Definition at line 144 of file Checker.h.

Member Function Documentation

◆ stop()

template<class Protocol>
void xrpl::PeerFinder::Checker< Protocol >::stop ( )

Stop the service.

Pending I/O operations will be canceled. This issues cancel orders for all pending I/O operations and then returns immediately. Handlers will receive operation_aborted errors, or if they were already queued they will complete normally.

Definition at line 151 of file Checker.h.

◆ wait()

template<class Protocol>
void xrpl::PeerFinder::Checker< Protocol >::wait ( )

Block until all pending I/O completes.

Definition at line 164 of file Checker.h.

◆ asyncConnect()

template<class Protocol>
template<class Handler>
void xrpl::PeerFinder::Checker< Protocol >::asyncConnect ( beast::IP::Endpoint const & endpoint,
Handler && handler )

Performs an async connection test on the specified endpoint.

The port must be non-zero. Note that the execution guarantees offered by asio handlers are NOT enforced.

Definition at line 174 of file Checker.h.

◆ remove()

template<class Protocol>
void xrpl::PeerFinder::Checker< Protocol >::remove ( BasicAsyncOp & op)
private

Definition at line 189 of file Checker.h.

Member Data Documentation

◆ mutex_

template<class Protocol = boost::asio::ip::tcp>
std::mutex xrpl::PeerFinder::Checker< Protocol >::mutex_
private

Definition at line 63 of file Checker.h.

◆ cond_

template<class Protocol = boost::asio::ip::tcp>
std::condition_variable xrpl::PeerFinder::Checker< Protocol >::cond_
private

Definition at line 64 of file Checker.h.

◆ ioContext_

template<class Protocol = boost::asio::ip::tcp>
boost::asio::io_context& xrpl::PeerFinder::Checker< Protocol >::ioContext_
private

Definition at line 65 of file Checker.h.

◆ list_

template<class Protocol = boost::asio::ip::tcp>
list_type xrpl::PeerFinder::Checker< Protocol >::list_
private

Definition at line 66 of file Checker.h.

◆ stop_

template<class Protocol = boost::asio::ip::tcp>
bool xrpl::PeerFinder::Checker< Protocol >::stop_ = false
private

Definition at line 67 of file Checker.h.