32#ifndef HORIZON_CHAR_CLIENTSOCKETMGR_HPP
33#define HORIZON_CHAR_CLIENTSOCKETMGR_HPP
71 bool start(
int segment_number = 1)
87 std::chrono::high_resolution_clock::time_point
start = std::chrono::high_resolution_clock::now();
92 DWORD cpu = GetCurrentProcessorNumber();
96 int cpu = sched_getcpu();
102 std::chrono::high_resolution_clock::time_point end = std::chrono::high_resolution_clock::now();
103 std::chrono::nanoseconds time_span = std::chrono::duration_cast<std::chrono::nanoseconds>(end -
start);
146 bool start(boost::asio::io_context &io_context, std::string
const &listen_ip, uint16_t port, uint32_t threads = 1,
bool minimal =
false)
override;
164 for (
auto s : socket_map) {
165 if (s.second->get_session() !=
nullptr)
166 s.second->get_session()->update(time);
172#define sClientSocketMgr Horizon::Char::ClientSocketMgr::Instance()
#define sChar
Definition: Char.hpp:143
@ RESOURCE_PRIORITY_PRIMARY
Definition: Server.hpp:79
Definition: ClientSocketMgr.hpp:53
virtual bool is_finalized() override
Definition: ClientSocketMgr.hpp:120
std::atomic< bool > _is_finalized
Definition: ClientSocketMgr.hpp:123
ResourceManager _resource_manager
Definition: ClientSocketMgr.hpp:128
virtual void initialize(int segment_number=1) override
Definition: ClientSocketMgr.hpp:107
virtual void finalize() override
Definition: ClientSocketMgr.hpp:113
void update() override
Updates the network thread and schedules a recursive call to itself.
Definition: ClientSocketMgr.hpp:85
bool start(int segment_number=1)
Initializes the network thread and runs.
Definition: ClientSocketMgr.hpp:71
CharNetworkThread()
Definition: ClientSocketMgr.hpp:65
void run() override
Run the I/O Service loop within this network thread.
Definition: ClientSocketMgr.hpp:80
virtual bool is_initialized() override
Definition: ClientSocketMgr.hpp:119
void on_socket_removed(std::shared_ptr< CharSocket > socket) override
Definition: ClientSocketMgr.hpp:55
void on_socket_added(std::shared_ptr< CharSocket > socket) override
Definition: ClientSocketMgr.hpp:60
std::atomic< bool > _is_initialized
Definition: ClientSocketMgr.hpp:122
ResourceManager & get_resource_manager()
Definition: ClientSocketMgr.hpp:130
Definition: CharSocket.hpp:47
Manager of client sockets and initialization of the packet db *.
Definition: ClientSocketMgr.hpp:137
static ClientSocketMgr * Instance()
Definition: ClientSocketMgr.hpp:140
bool stop()
Definition: ClientSocketMgr.hpp:148
void update_sessions(uint64_t time)
Definition: ClientSocketMgr.hpp:160
Horizon::Networking::AcceptSocketMgr< CharSocket, CharNetworkThread > BaseSocketMgr
Definition: ClientSocketMgr.hpp:138
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
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