Horizon Official Technical Documentation
|
|
#include <CharSession.hpp>
Public Member Functions | |
CharSession (uint64_t uid) | |
~CharSession () | |
void | initialize () |
void | update (uint32_t diff) |
void | perform_cleanup () |
std::unique_ptr< CharClientInterface > & | clif () |
std::unique_ptr< ClientPacketLengthTable > & | pkt_tbl () |
s_session_data & | get_session_data () |
void | set_session_data (s_session_data &data) |
void | transmit_buffer (ByteBuffer _buffer, std::size_t size) |
![]() | |
Session (uint64_t uid) | |
virtual | ~Session () |
std::shared_ptr< CharSocket > | get_socket () |
Get the socket. More... | |
void | set_socket (std::weak_ptr< CharSocket > socket) |
Set the socket. More... | |
virtual void | update (uint32_t diff)=0 |
virtual void | initialize ()=0 |
bool | is_initialized () |
Called to verify if the session is initialized. More... | |
void | set_initialized (bool initialized) |
Set whether the session is initialized or not. More... | |
uint64_t | get_session_id () |
Get the unique id of the session. More... | |
ThreadSafeQueue< ByteBuffer > & | get_recv_queue () |
Receive queue of the buffer received by the socket. More... | |
Protected Attributes | |
std::unique_ptr< CharClientInterface > | _clif |
std::unique_ptr< ClientPacketLengthTable > | _pkt_tbl |
s_session_data | _session_data |
std::mutex | _sd_mutex |
bool | _first_packet_sent {false} |
CharSession::CharSession | ( | uint64_t | uid | ) |
CharSession::~CharSession | ( | ) |
|
inline |
References _clif.
|
inline |
References _sd_mutex, and _session_data.
|
virtual |
Called when the session is started. Virtual method that must be implmented by the derived class. Typically used to initialize the session.
Implements Horizon::Networking::Session< CharSocket, CharSession >.
References _clif, _pkt_tbl, and Horizon::Networking::Session< CharSocket, CharSession >::set_initialized().
void Horizon::Char::CharSession::perform_cleanup | ( | ) |
|
inline |
|
inline |
References _sd_mutex, and _session_data.
void CharSession::transmit_buffer | ( | ByteBuffer | _buffer, |
std::size_t | size | ||
) |
References _first_packet_sent, _pkt_tbl, ByteBuffer::active_length(), ByteBuffer::get_read_pointer(), Horizon::Networking::Session< CharSocket, CharSession >::get_socket(), HLog, and ByteBuffer::is_empty().
|
virtual |
Called when the session is started. Virtual method that must be implmented by the derived class. Typically used to update the session and process packets.
Implements Horizon::Networking::Session< CharSocket, CharSession >.
References _pkt_tbl, Horizon::Networking::Session< CharSocket, CharSession >::get_recv_queue(), and HLog.
|
protected |
Referenced by clif(), and initialize().
|
protected |
Referenced by transmit_buffer().
|
protected |
Referenced by initialize(), pkt_tbl(), transmit_buffer(), and update().
|
protected |
Referenced by get_session_data(), and set_session_data().
|
protected |
Referenced by get_session_data(), and set_session_data().