Electroneum
epee::net_utils::connection< t_protocol_handler > Class Template Reference

Represents a single connection from a client. More...

#include <abstract_tcp_server2.h>

Inheritance diagram for epee::net_utils::connection< t_protocol_handler >:
Collaboration diagram for epee::net_utils::connection< t_protocol_handler >:

Classes

struct  shared_state
 

Public Types

typedef t_protocol_handler::connection_context t_connection_context
 

Public Member Functions

 connection (boost::asio::io_service &io_service, boost::shared_ptr< shared_state > state, t_connection_type connection_type, epee::net_utils::ssl_support_t ssl_support)
 Construct a connection with the given io_service. More...
 
 connection (boost::asio::ip::tcp::socket &&sock, boost::shared_ptr< shared_state > state, t_connection_type connection_type, epee::net_utils::ssl_support_t ssl_support)
 
virtual ~connection () noexcept(false)
 
bool start (bool is_income, bool is_multithreaded)
 Start the first asynchronous operation for the connection. More...
 
bool start (bool is_income, bool is_multithreaded, network_address real_remote)
 
void get_context (t_connection_context &context_)
 
void call_back_starter ()
 
void save_dbg_log ()
 
bool speed_limit_is_enabled () const
 tells us should we be sleeping here (e.g. do not sleep on RPC connections) More...
 
bool cancel ()
 
void setRpcStation ()
 
- Public Member Functions inherited from epee::net_utils::connection_basic
 connection_basic (boost::asio::ip::tcp::socket &&socket, boost::shared_ptr< connection_basic_shared_state > state, ssl_support_t ssl_support)
 
 connection_basic (boost::asio::io_service &io_service, boost::shared_ptr< connection_basic_shared_state > state, ssl_support_t ssl_support)
 
virtual ~connection_basic () noexcept(false)
 
connection_basic_shared_stateget_state () noexcept
 
 connection_basic (boost::asio::io_service &io_service, std::atomic< long > &ref_sock_count, std::atomic< long > &sock_number, ssl_support_t ssl)
 
boost::asio::ip::tcp::socket & socket ()
 
ssl_support_t get_ssl_support () const
 
void disable_ssl ()
 
bool handshake (boost::asio::ssl::stream_base::handshake_type type)
 
template<typename MutableBufferSequence , typename ReadHandler >
void async_read_some (const MutableBufferSequence &buffers, ReadHandler &&handler)
 
template<typename ConstBufferSequence , typename WriteHandler >
void async_write_some (const ConstBufferSequence &buffers, WriteHandler &&handler)
 
template<typename ConstBufferSequence , typename WriteHandler >
void async_write (const ConstBufferSequence &buffers, WriteHandler &&handler)
 
void do_send_handler_write (const void *ptr, size_t cb)
 
void do_send_handler_write_from_queue (const boost::system::error_code &e, size_t cb, int q_len)
 
void logger_handle_net_write (size_t size)
 
void logger_handle_net_read (size_t size)
 
void sleep_before_packet (size_t packet_size, int phase, int q_len)
 

Additional Inherited Members

- Static Public Member Functions inherited from epee::net_utils::connection_basic
static void set_rate_up_limit (uint64_t limit)
 
static void set_rate_down_limit (uint64_t limit)
 
static uint64_t get_rate_up_limit ()
 
static uint64_t get_rate_down_limit ()
 
static void set_tos_flag (int tos)
 
static int get_tos_flag ()
 
static void save_limit_to_file (int limit)
 for dr-electroneum More...
 
static double get_sleep_time (size_t cb)
 
static void set_save_graph (bool save_graph)
 
- Public Attributes inherited from epee::net_utils::connection_basic
std::unique_ptr< connection_basic_pimplmI
 
volatile uint32_t m_want_close_connection
 
std::atomic< boolm_was_shutdown
 
critical_section m_send_que_lock
 
std::list< std::string > m_send_que
 
volatile bool m_is_multithreaded
 
boost::asio::io_service::strand strand_
 Strand to ensure the connection's handlers are not called concurrently. More...
 
boost::asio::ssl::stream< boost::asio::ip::tcp::socket > socket_
 Socket for the connection. More...
 
ssl_support_t m_ssl_support
 
- Protected Member Functions inherited from epee::net_utils::i_service_endpoint
virtual ~i_service_endpoint () noexcept(false)
 

Detailed Description

template<class t_protocol_handler>
class epee::net_utils::connection< t_protocol_handler >

Represents a single connection from a client.

Definition at line 84 of file abstract_tcp_server2.h.

Member Typedef Documentation

◆ t_connection_context

template<class t_protocol_handler >
typedef t_protocol_handler::connection_context epee::net_utils::connection< t_protocol_handler >::t_connection_context

Definition at line 91 of file abstract_tcp_server2.h.

Constructor & Destructor Documentation

◆ connection() [1/2]

template<class t_protocol_handler >
epee::net_utils::connection< t_protocol_handler >::connection ( boost::asio::io_service &  io_service,
boost::shared_ptr< shared_state state,
t_connection_type  connection_type,
epee::net_utils::ssl_support_t  ssl_support 
)
explicit

Construct a connection with the given io_service.

◆ connection() [2/2]

template<class t_protocol_handler >
epee::net_utils::connection< t_protocol_handler >::connection ( boost::asio::ip::tcp::socket &&  sock,
boost::shared_ptr< shared_state state,
t_connection_type  connection_type,
epee::net_utils::ssl_support_t  ssl_support 
)
explicit

◆ ~connection()

template<class t_protocol_handler >
virtual epee::net_utils::connection< t_protocol_handler >::~connection ( )
virtualnoexcept

Member Function Documentation

◆ call_back_starter()

template<class t_protocol_handler >
void epee::net_utils::connection< t_protocol_handler >::call_back_starter ( )

◆ cancel()

template<class t_protocol_handler >
bool epee::net_utils::connection< t_protocol_handler >::cancel ( )

◆ get_context()

template<class t_protocol_handler >
void epee::net_utils::connection< t_protocol_handler >::get_context ( t_connection_context context_)
inline

Definition at line 125 of file abstract_tcp_server2.h.

125 {context_ = context;}
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

◆ save_dbg_log()

template<class t_protocol_handler >
void epee::net_utils::connection< t_protocol_handler >::save_dbg_log ( )

◆ setRpcStation()

template<class t_protocol_handler >
void epee::net_utils::connection< t_protocol_handler >::setRpcStation ( )

◆ speed_limit_is_enabled()

template<class t_protocol_handler >
bool epee::net_utils::connection< t_protocol_handler >::speed_limit_is_enabled ( ) const

tells us should we be sleeping here (e.g. do not sleep on RPC connections)

◆ start() [1/2]

template<class t_protocol_handler >
bool epee::net_utils::connection< t_protocol_handler >::start ( bool  is_income,
bool  is_multithreaded 
)

Start the first asynchronous operation for the connection.

◆ start() [2/2]

template<class t_protocol_handler >
bool epee::net_utils::connection< t_protocol_handler >::start ( bool  is_income,
bool  is_multithreaded,
network_address  real_remote 
)

The documentation for this class was generated from the following file: