32#ifndef HORIZON_ZONE_CLIENTSOCKETMGR_HPP
33#define HORIZON_ZONE_CLIENTSOCKETMGR_HPP
66 bool start(
int segment_number = 1)
override
83 std::chrono::high_resolution_clock::time_point
start = std::chrono::high_resolution_clock::now();
89 DWORD cpu = GetCurrentProcessorNumber();
93 int cpu = sched_getcpu();
98 std::chrono::high_resolution_clock::time_point end = std::chrono::high_resolution_clock::now();
99 std::chrono::nanoseconds time_span = std::chrono::duration_cast<std::chrono::nanoseconds>(end -
start);
137 bool start(boost::asio::io_context &io_context, std::string
const &listen_ip, uint16_t port, uint32_t threads = 1,
bool minimal =
false);
145 for (
auto s : socket_map) {
146 if (s.second->get_session() !=
nullptr)
147 s.second->get_session()->update(time);
@ RESOURCE_PRIORITY_PRIMARY
Definition: Server.hpp:79
Socket Manager for Accepted Sockets.
Definition: AcceptSocketMgr.hpp:49
SocketMap & get_sockets()
Definition: AcceptSocketMgr.hpp:155
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
void process_queue()
Definition: System.hpp:676
Manager of client sockets.
Definition: ClientSocketMgr.hpp:134
bool stop()
Definition: ClientSocketMgr.cpp:22
bool start(boost::asio::io_context &io_context, std::string const &listen_ip, uint16_t port, uint32_t threads=1, bool minimal=false)
Initialize and start accepting connections asynchronously.
Definition: ClientSocketMgr.cpp:10
void update_sessions(uint64_t time)
Definition: ClientSocketMgr.hpp:141
Horizon::Networking::AcceptSocketMgr< ZoneSocket, ZoneNetworkThread > BaseSocketMgr
Definition: ClientSocketMgr.hpp:135
Definition: ClientSocketMgr.hpp:52
void update() override
Updates the network thread and schedules a recursive call to itself.
Definition: ClientSocketMgr.hpp:81
virtual void initialize(int segment_number=1) override
Definition: ClientSocketMgr.hpp:103
virtual bool is_finalized() override
Definition: ClientSocketMgr.hpp:117
bool start(int segment_number=1) override
Initializes the network thread and runs.
Definition: ClientSocketMgr.hpp:66
void run() override
Run the I/O Service loop within this network thread.
Definition: ClientSocketMgr.hpp:75
std::atomic< bool > _is_finalized
Definition: ClientSocketMgr.hpp:120
virtual bool is_initialized() override
Definition: ClientSocketMgr.hpp:116
ZoneNetworkThread()
Definition: ClientSocketMgr.cpp:4
void on_socket_added(std::shared_ptr< ZoneSocket > socket) override
Definition: ClientSocketMgr.hpp:59
void on_socket_removed(std::shared_ptr< ZoneSocket > socket) override
Definition: ClientSocketMgr.hpp:54
std::atomic< bool > _is_initialized
Definition: ClientSocketMgr.hpp:119
virtual void finalize() override
Definition: ClientSocketMgr.hpp:110
ResourceManager & get_resource_manager()
Definition: ClientSocketMgr.hpp:126
ResourceManager _resource_manager
Definition: ClientSocketMgr.hpp:124
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
Definition: Element.hpp:7