28#ifndef HORIZON_NETWORKING_SESSION_HPP
29#define HORIZON_NETWORKING_SESSION_HPP
53template <
class SocketType,
class SessionType>
54class Session :
public std::enable_shared_from_this<SessionType>
79 virtual void update(uint32_t diff) = 0;
A Session object that handles a single socket. Sockets are moved into the thread by SocketMgr,...
Definition: Session.hpp:55
virtual void update(uint32_t diff)=0
virtual ~Session()
Definition: Session.hpp:63
std::weak_ptr< SocketType > _socket
Definition: Session.hpp:104
ThreadSafeQueue< ByteBuffer > & get_recv_queue()
Receive queue of the buffer received by the socket.
Definition: Session.hpp:101
bool _is_initialized
Definition: Session.hpp:105
std::shared_ptr< SocketType > get_socket()
Get the socket.
Definition: Session.hpp:70
Session(uint64_t uid)
Definition: Session.hpp:57
virtual void initialize()=0
bool is_initialized()
Called to verify if the session is initialized.
Definition: Session.hpp:88
void set_socket(std::weak_ptr< SocketType > socket)
Set the socket.
Definition: Session.hpp:74
uint64_t get_session_id()
Get the unique id of the session.
Definition: Session.hpp:97
ThreadSafeQueue< ByteBuffer > _buffer_recv_queue
Definition: Session.hpp:103
void set_initialized(bool initialized)
Set whether the session is initialized or not.
Definition: Session.hpp:93
uint64_t _uid
Definition: Session.hpp:106
Definition: Element.hpp:7