rippled
Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
ripple::InboundHandoff Class Reference

Sends HTTP response. More...

Inheritance diagram for ripple::InboundHandoff:
Inheritance graph
[legend]
Collaboration diagram for ripple::InboundHandoff:
Collaboration graph
[legend]

Public Member Functions

virtual ~InboundHandoff () override=default
 
 InboundHandoff (Application &app, id_t id, std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type &&request, PublicKey const &publicKey, ProtocolVersion protocol, Resource::Consumer consumer, std::unique_ptr< stream_type > &&stream_ptr, OverlayImpl &overlay)
 
 InboundHandoff (InboundHandoff const &)=delete
 
InboundHandoffoperator= (InboundHandoff const &)=delete
 
void run ()
 Start the handshake. More...
 
void stop () override
 Stop the child. More...
 
shared_from_this (T... args)
 
weak_from_this (T... args)
 

Protected Attributes

OverlayImploverlay_
 

Private Types

using error_code = boost::system::error_code
 
using socket_type = boost::asio::ip::tcp::socket
 
using middle_type = boost::beast::tcp_stream
 
using stream_type = boost::beast::ssl_stream< middle_type >
 
using id_t = Peer::id_t
 

Private Member Functions

void sendResponse ()
 Send upgrade response to the client. More...
 
void createPeer ()
 Instantiate and run the overlay peer. More...
 
void fail (std::string const &name, error_code const &ec)
 Log and close. More...
 
void fail (std::string const &reason)
 Log and close. More...
 
void close ()
 Close connection. More...
 
socket_typesocket () const
 Get underlying socket. More...
 

Private Attributes

Applicationapp_
 
const id_t id_
 
beast::WrappedSink sink_
 
const beast::Journal journal_
 
std::unique_ptr< stream_typestream_ptr_
 
boost::asio::strand< boost::asio::executor > strand_
 
const beast::IP::Endpoint remote_address_
 
ProtocolVersion protocol_
 
const PublicKey publicKey_
 
Resource::Consumer usage_
 
const std::shared_ptr< PeerFinder::Slotslot_
 
http_request_type request_
 

Detailed Description

Sends HTTP response.

Instantiates the inbound peer once the response is sent. Maintains all data members required for the inbound peer instantiation.

Definition at line 31 of file InboundHandoff.h.

Member Typedef Documentation

◆ error_code

using ripple::InboundHandoff::error_code = boost::system::error_code
private

Definition at line 35 of file InboundHandoff.h.

◆ socket_type

using ripple::InboundHandoff::socket_type = boost::asio::ip::tcp::socket
private

Definition at line 36 of file InboundHandoff.h.

◆ middle_type

using ripple::InboundHandoff::middle_type = boost::beast::tcp_stream
private

Definition at line 37 of file InboundHandoff.h.

◆ stream_type

using ripple::InboundHandoff::stream_type = boost::beast::ssl_stream<middle_type>
private

Definition at line 38 of file InboundHandoff.h.

◆ id_t

Definition at line 39 of file InboundHandoff.h.

Constructor & Destructor Documentation

◆ ~InboundHandoff()

virtual ripple::InboundHandoff::~InboundHandoff ( )
overridevirtualdefault

◆ InboundHandoff() [1/2]

ripple::InboundHandoff::InboundHandoff ( Application app,
id_t  id,
std::shared_ptr< PeerFinder::Slot > const &  slot,
http_request_type &&  request,
PublicKey const &  publicKey,
ProtocolVersion  protocol,
Resource::Consumer  consumer,
std::unique_ptr< stream_type > &&  stream_ptr,
OverlayImpl overlay 
)

Definition at line 28 of file InboundHandoff.cpp.

◆ InboundHandoff() [2/2]

ripple::InboundHandoff::InboundHandoff ( InboundHandoff const &  )
delete

Member Function Documentation

◆ operator=()

InboundHandoff& ripple::InboundHandoff::operator= ( InboundHandoff const &  )
delete

◆ run()

void ripple::InboundHandoff::run ( )

Start the handshake.

Definition at line 61 of file InboundHandoff.cpp.

◆ stop()

void ripple::InboundHandoff::stop ( )
overridevirtual

Stop the child.

Implements ripple::OverlayImpl::Child.

Definition at line 70 of file InboundHandoff.cpp.

◆ sendResponse()

void ripple::InboundHandoff::sendResponse ( )
private

Send upgrade response to the client.

Definition at line 83 of file InboundHandoff.cpp.

◆ createPeer()

void ripple::InboundHandoff::createPeer ( )
private

Instantiate and run the overlay peer.

Definition at line 163 of file InboundHandoff.cpp.

◆ fail() [1/2]

void ripple::InboundHandoff::fail ( std::string const &  name,
error_code const &  ec 
)
private

Log and close.

Definition at line 129 of file InboundHandoff.cpp.

◆ fail() [2/2]

void ripple::InboundHandoff::fail ( std::string const &  reason)
private

Log and close.

Definition at line 141 of file InboundHandoff.cpp.

◆ close()

void ripple::InboundHandoff::close ( )
private

Close connection.

Definition at line 153 of file InboundHandoff.cpp.

◆ socket()

InboundHandoff::socket_type & ripple::InboundHandoff::socket ( ) const
private

Get underlying socket.

Definition at line 180 of file InboundHandoff.cpp.

Member Data Documentation

◆ app_

Application& ripple::InboundHandoff::app_
private

Definition at line 40 of file InboundHandoff.h.

◆ id_

const id_t ripple::InboundHandoff::id_
private

Definition at line 41 of file InboundHandoff.h.

◆ sink_

beast::WrappedSink ripple::InboundHandoff::sink_
private

Definition at line 42 of file InboundHandoff.h.

◆ journal_

const beast::Journal ripple::InboundHandoff::journal_
private

Definition at line 43 of file InboundHandoff.h.

◆ stream_ptr_

std::unique_ptr<stream_type> ripple::InboundHandoff::stream_ptr_
private

Definition at line 44 of file InboundHandoff.h.

◆ strand_

boost::asio::strand<boost::asio::executor> ripple::InboundHandoff::strand_
private

Definition at line 45 of file InboundHandoff.h.

◆ remote_address_

const beast::IP::Endpoint ripple::InboundHandoff::remote_address_
private

Definition at line 46 of file InboundHandoff.h.

◆ protocol_

ProtocolVersion ripple::InboundHandoff::protocol_
private

Definition at line 47 of file InboundHandoff.h.

◆ publicKey_

const PublicKey ripple::InboundHandoff::publicKey_
private

Definition at line 48 of file InboundHandoff.h.

◆ usage_

Resource::Consumer ripple::InboundHandoff::usage_
private

Definition at line 49 of file InboundHandoff.h.

◆ slot_

const std::shared_ptr<PeerFinder::Slot> ripple::InboundHandoff::slot_
private

Definition at line 50 of file InboundHandoff.h.

◆ request_

http_request_type ripple::InboundHandoff::request_
private

Definition at line 51 of file InboundHandoff.h.

◆ overlay_

OverlayImpl& ripple::OverlayImpl::Child::overlay_
protectedinherited

Definition at line 64 of file OverlayImpl.h.