Horizon Official Technical Documentation
|
|
declared to avoid recursive inclusion of header files. More...
#include <ZoneSocket.hpp>
Public Member Functions | |
ZoneSocket (uint64_t uid, std::shared_ptr< tcp::socket > socket) | |
~ZoneSocket () | |
void | start () override |
Initial method invoked once from the network thread that handles the ZoneSocket. More... | |
bool | update () override |
Asynchronous update method periodically called from network threads. More... | |
std::shared_ptr< ZoneSession > | get_session () |
Session dependency. More... | |
void | set_session (std::shared_ptr< ZoneSession > session) |
![]() | |
Socket (uint64_t socket_id) | |
Socket (uint64_t socket_id, std::shared_ptr< tcp::socket > socket) | |
virtual | ~Socket () |
virtual void | start ()=0 |
Initial method invoked once from the network thread that handles the AuthSocket. More... | |
virtual bool | update () |
Socket update loop called from its NetworkThread every n nanoseconds. More... | |
uint64_t | get_socket_id () |
std::string & | remote_ip_address () |
uint16_t | remote_port () const |
void | async_read () |
Asynchronous read operation @thread NetworkThread. More... | |
void | async_read_with_callback (ByteBuffer &buf, void(Socket< ZoneSocket >::*)(boost::system::error_code, std::size_t)) |
Asynchronous read operation with callback handler @thread NetworkThread. More... | |
virtual void | queue_buffer (ByteBuffer &&buffer) |
bool | is_open () |
void | close_socket () |
Socket close operation that performs cleanups before shutting down the connection. More... | |
void | delayed_close_socket () |
ByteBuffer & | get_read_buffer () |
Protected Member Functions | |
void | read_handler () override |
Incoming buffer read handler. More... | |
void | on_close () override |
Socket cleanup method on connection closure. More... | |
void | on_error () override |
Socket error handler. More... | |
![]() | |
virtual void | on_close ()=0 |
virtual void | read_handler ()=0 |
virtual void | on_error ()=0 |
bool | async_process_queue () |
Socket write operation. More... | |
void | set_no_delay (bool enable) |
Disable the Nagle Algorithm on our socket. More... | |
std::size_t | write_buffer_and_send (ByteBuffer &to_send, boost::system::error_code &error) |
Write a message to the buffer. More... | |
Protected Attributes | |
std::shared_ptr< ZoneSession > | _session |
Private Types | |
typedef Socket< ZoneSocket > | BaseSocket |
declared to avoid recursive inclusion of header files.
|
private |
ZoneSocket::ZoneSocket | ( | uint64_t | uid, |
std::shared_ptr< tcp::socket > | socket | ||
) |
|
inline |
std::shared_ptr< ZoneSession > ZoneSocket::get_session | ( | ) |
Session dependency.
References _session.
Referenced by on_close(), on_error(), and read_handler().
|
overrideprotectedvirtual |
Socket cleanup method on connection closure.
Implements Horizon::Networking::Socket< ZoneSocket >.
References get_session(), HLog, and Horizon::Networking::Socket< ZoneSocket >::remote_ip_address().
|
overrideprotectedvirtual |
Socket error handler.
Implements Horizon::Networking::Socket< ZoneSocket >.
References get_session().
|
overrideprotectedvirtual |
Incoming buffer read handler.
Implements Horizon::Networking::Socket< ZoneSocket >.
References ByteBuffer::active_length(), ByteBuffer::append(), Horizon::Networking::Socket< ZoneSocket >::close_socket(), Horizon::Networking::Socket< ZoneSocket >::get_read_buffer(), get_session(), HLog, and ByteBuffer::read_completed().
void ZoneSocket::set_session | ( | std::shared_ptr< ZoneSession > | session | ) |
|
overridevirtual |
Initial method invoked once from the network thread that handles the ZoneSocket.
Implements Horizon::Networking::Socket< ZoneSocket >.
References Horizon::Networking::Socket< ZoneSocket >::async_read(), Horizon::Networking::Socket< ZoneSocket >::get_socket_id(), HLog, Horizon::Networking::Socket< ZoneSocket >::remote_ip_address(), and set_session().
|
overridevirtual |
Asynchronous update method periodically called from network threads.
@thread NetworkThread
Reimplemented from Horizon::Networking::Socket< ZoneSocket >.
|
protected |
Referenced by get_session(), and set_session().