32#ifndef HORIZON_CLIENTSOCKETMGR_HPP
33#define HORIZON_CLIENTSOCKETMGR_HPP
72 bool start(
int segment_number = 1)
89 std::chrono::high_resolution_clock::time_point
start = std::chrono::high_resolution_clock::now();
95 DWORD cpu = GetCurrentProcessorNumber();
99 int cpu = sched_getcpu();
105 std::chrono::high_resolution_clock::time_point end = std::chrono::high_resolution_clock::now();
106 std::chrono::nanoseconds time_span = std::chrono::duration_cast<std::chrono::nanoseconds>(end -
start);
149 bool start(boost::asio::io_context &io_context, std::string
const &listen_ip, uint16_t port, uint32_t threads = 1,
bool minimal =
false)
override;
167 for (
auto s : socket_map) {
168 if (s.second->get_session() !=
nullptr)
169 s.second->get_session()->update(time);
176#define sClientSocketMgr Horizon::Auth::ClientSocketMgr::Instance()
#define sAuth
Definition: Auth.hpp:131
@ RESOURCE_PRIORITY_PRIMARY
Definition: Server.hpp:79
Definition: ClientSocketMgr.hpp:54
bool start(int segment_number=1)
Initializes the network thread and runs.
Definition: ClientSocketMgr.hpp:72
void on_socket_added(std::shared_ptr< AuthSocket > socket) override
Definition: ClientSocketMgr.hpp:61
virtual void finalize() override
Definition: ClientSocketMgr.hpp:116
void on_socket_removed(std::shared_ptr< AuthSocket > socket) override
Definition: ClientSocketMgr.hpp:56
ResourceManager _resource_manager
Definition: ClientSocketMgr.hpp:132
void run() override
Run the I/O Service loop within this network thread.
Definition: ClientSocketMgr.hpp:82
virtual void initialize(int segment_number=1) override
Definition: ClientSocketMgr.hpp:110
ResourceManager & get_resource_manager()
Definition: ClientSocketMgr.hpp:134
std::atomic< bool > _is_initialized
Definition: ClientSocketMgr.hpp:127
AuthNetworkThread()
Definition: ClientSocketMgr.hpp:66
virtual bool is_initialized() override
Definition: ClientSocketMgr.hpp:123
std::atomic< bool > _is_finalized
Definition: ClientSocketMgr.hpp:128
void update() override
Updates the network thread and schedules a recursive call to itself.
Definition: ClientSocketMgr.hpp:87
virtual bool is_finalized() override
Definition: ClientSocketMgr.hpp:124
Definition: AuthSocket.hpp:47
Manager of client sockets and initialization of the packet db *.
Definition: ClientSocketMgr.hpp:140
bool stop()
Definition: ClientSocketMgr.hpp:151
Networking::AcceptSocketMgr< AuthSocket, AuthNetworkThread > BaseSocketMgr
Definition: ClientSocketMgr.hpp:141
bool start(boost::asio::io_context &io_context, std::string const &listen_ip, uint16_t port, uint32_t threads=1, bool minimal=false) override
Initialize and start accepting connections asynchronously.
Definition: ClientSocketMgr.cpp:35
static ClientSocketMgr * Instance()
Definition: ClientSocketMgr.hpp:143
void update_sessions(uint64_t time)
Definition: ClientSocketMgr.hpp:163
Socket Manager for Accepted Sockets.
Definition: AcceptSocketMgr.hpp:49
SocketMap & get_sockets()
Definition: AcceptSocketMgr.hpp:155
virtual bool stop_network() override
Stop the Acceptor network and clear the client socket map.
Definition: AcceptSocketMgr.hpp:91
A Network Thread object that handles a number of sockets.
Definition: NetworkThread.hpp:55
virtual void finalize()
Halts the IO Service and marks the network thread as stopped.
Definition: NetworkThread.hpp:76
virtual void update()
Updates the network thread and schedules a recursive call to itself.
Definition: NetworkThread.hpp:163
virtual void run()
Run the I/O Service loop within this network thread.
Definition: NetworkThread.hpp:143
network_thread_map & get_thread_map()
Definition: SocketMgr.hpp:155
void process_queue()
Definition: System.hpp:676
Definition: Server.hpp:192
void set_thread_cpu_id(int cpu_id)
Definition: Server.hpp:239
Horizon::System::SystemRoutineManager & get_system_routine_manager()
Definition: Server.hpp:235
void set_total_execution_time(int time)
Definition: Server.hpp:245
void calculate_and_set_cpu_load()
Definition: Server.hpp:257
void set_segment_number(int64_t segment_number)
Definition: Server.hpp:206
int get_thread_cpu_id()
Definition: Server.hpp:240
void remove(Key key)
Definition: Server.hpp:163
void add(Key key, Value value)
Definition: Server.hpp:157
Definition: Server.hpp:113
@ RUNTIME_NETWORKING
Definition: System.hpp:84
Definition: Element.hpp:7
Definition: Server.hpp:93