1#ifndef XRPL_OVERLAY_CONNECTATTEMPT_H_INCLUDED
2#define XRPL_OVERLAY_CONNECTATTEMPT_H_INCLUDED
4#include <xrpld/overlay/detail/OverlayImpl.h>
48 boost::beast::http::request<boost::beast::http::empty_body>;
50 boost::beast::http::response<boost::beast::http::dynamic_body>;
106 boost::asio::strand<boost::asio::io_context::executor_type>
strand_;
107 boost::asio::basic_waitable_timer<std::chrono::steady_clock>
timer_;
108 boost::asio::basic_waitable_timer<std::chrono::steady_clock>
stepTimer_;
142 boost::asio::io_context& io_context,
245 return "TlsHandshake";
253 return "ShutdownStarted";
258 template <
class =
void>
259 static boost::asio::ip::tcp::endpoint
267 ec = boost::system::errc::make_error_code(
268 boost::system::errc::invalid_argument);
269 return boost::asio::ip::tcp::endpoint{};
A version-independent IP address and port combination.
A generic endpoint for log messages.
Wraps a Journal::Sink to prefix its output with a string.
Manages outbound peer connection attempts with comprehensive timeout handling.
static constexpr std::chrono::seconds connectTimeout
boost::beast::tcp_stream middle_type
void stop() override
Stop the connection attempt.
boost::asio::ip::tcp::socket socket_type
void cancelTimer()
Cancel both global and step timers.
boost::system::error_code error_code
std::unique_ptr< stream_type > stream_ptr_
std::shared_ptr< PeerFinder::Slot > slot_
ConnectionStep currentStep_
Resource::Consumer usage_
boost::asio::strand< boost::asio::io_context::executor_type > strand_
static std::string stepToString(ConnectionStep step)
void run()
Begin the connection attempt.
void onHandshake(error_code ec)
boost::asio::ip::tcp::endpoint endpoint_type
void onWrite(error_code ec)
void processResponse()
Process the HTTP upgrade response from peer.
void onTimer(error_code ec)
Handle timer expiration events.
void setTimer(ConnectionStep step)
Set timers for the specified connection step.
boost::beast::http::response< boost::beast::http::dynamic_body > response_type
void onShutdown(error_code ec)
boost::beast::ssl_stream< middle_type > stream_type
boost::beast::multi_buffer read_buf_
void onConnect(error_code ec)
void fail(std::string const &reason)
void onRead(error_code ec)
static boost::asio::ip::tcp::endpoint parse_endpoint(std::string const &s, boost::system::error_code &ec)
beast::Journal const journal_
boost::beast::http::request< boost::beast::http::empty_body > request_type
ConnectionStep
Represents the current phase of the connection establishment process.
boost::asio::basic_waitable_timer< std::chrono::steady_clock > timer_
endpoint_type remote_endpoint_
boost::asio::basic_waitable_timer< std::chrono::steady_clock > stepTimer_
An endpoint that consumes resources.
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)
Defines timeout values for each connection step.
static constexpr std::chrono::seconds tcpConnect
static constexpr std::chrono::seconds tlsShutdown
static constexpr std::chrono::seconds tlsHandshake
static constexpr std::chrono::seconds httpWrite
static constexpr std::chrono::seconds httpRead