Horizon Official Technical Documentation
|
|
#include <ClientSocketMgr.hpp>
Public Member Functions | |
ZoneNetworkThread () | |
bool | start (int segment_number=1) override |
Initializes the network thread and runs. More... | |
void | run () override |
Run the I/O Service loop within this network thread. More... | |
void | update () override |
Updates the network thread and schedules a recursive call to itself. More... | |
virtual void | initialize (int segment_number=1) override |
virtual void | finalize () override |
virtual bool | is_initialized () override |
virtual bool | is_finalized () override |
![]() | |
KernelComponent (Kernel *kernel, Horizon::System::runtime_module_type module_type) | |
virtual void | initialize (int segment_number=1) |
virtual void | finalize () |
virtual bool | is_initialized () |
virtual bool | is_finalized () |
void | set_segment_number (int64_t segment_number) |
int64_t | get_segment_number () |
void | system_routine_queue_push (std::shared_ptr< Horizon::System::RuntimeContext > context) |
void | system_routine_queue_push (std::shared_ptr< Horizon::System::RuntimeContextChain > context) |
void | system_routine_process_queue () |
void | system_routine_register (Horizon::System::runtime_module_type module_t, Horizon::System::runtime_synchronization_method sync_t, std::shared_ptr< Horizon::System::RuntimeContext > context) |
const std::string | get_uuid_string () |
const std::string | get_type_string () |
Horizon::System::SystemRoutineManager & | get_system_routine_manager () |
Kernel * | get_kernel () |
void | set_thread_cpu_id (int cpu_id) |
int | get_thread_cpu_id () |
void | set_thread_update_rate (double rate) |
double | get_thread_update_rate () |
void | set_total_execution_time (int time) |
int | get_total_execution_time () |
void | calculate_and_set_cpu_load () |
![]() | |
NetworkThread () | |
virtual | ~NetworkThread () |
Destructor of the network thread, performs a clean network finalisation routine before deleting. More... | |
virtual void | finalize () |
Halts the IO Service and marks the network thread as stopped. More... | |
void | join () |
virtual bool | start (int segment_number=1) |
Initializes the network thread and runs. More... | |
virtual void | add_socket (std::shared_ptr< ZoneSocket > sock) |
Adds a new socket to a queue that is processed frequently within this network thread. More... | |
std::shared_ptr< tcp::socket > | get_new_socket () |
Gets a socket for a new connection. More... | |
int32_t | connection_count () const |
Gets the total number of network connections or sockets handled by this network thread. More... | |
bool | is_finalizing () |
Issues the status of network thread whether it is finalizing or not. More... | |
Protected Types | |
using | PrimaryResource = SharedPriorityResourceMedium< s_segment_storage< uint64_t, std::shared_ptr< ZoneSocket > > > |
using | ResourceManager = SharedPriorityResourceManager< PrimaryResource > |
Protected Member Functions | |
void | on_socket_removed (std::shared_ptr< ZoneSocket > socket) override |
void | on_socket_added (std::shared_ptr< ZoneSocket > socket) override |
ResourceManager & | get_resource_manager () |
![]() | |
virtual void | run () |
Run the I/O Service loop within this network thread. More... | |
virtual void | on_socket_removed (std::shared_ptr< ZoneSocket > sock)=0 |
virtual void | on_socket_added (std::shared_ptr< ZoneSocket > sock)=0 |
virtual void | update () |
Updates the network thread and schedules a recursive call to itself. More... | |
virtual void | add_new_sockets () |
Processess the new socket queue. More... | |
Protected Attributes | |
std::atomic< bool > | _is_initialized {false} |
std::atomic< bool > | _is_finalized {false} |
ResourceManager | _resource_manager |
![]() | |
SocketContainer | _active_sockets |
|
protected |
|
protected |
Horizon::Zone::ZoneNetworkThread::ZoneNetworkThread | ( | ) |
|
inlineoverridevirtual |
Reimplemented from KernelComponent.
References _is_finalized, and Horizon::Networking::NetworkThread< SocketType >::finalize().
|
inlineprotected |
References _resource_manager.
Referenced by on_socket_added(), and on_socket_removed().
|
inlineoverridevirtual |
Reimplemented from KernelComponent.
References _is_initialized, and KernelComponent::set_segment_number().
Referenced by start().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverrideprotected |
References get_resource_manager(), SharedPriorityResourceManager< SharedPriorityResourceMediums >::remove(), and RESOURCE_PRIORITY_PRIMARY.
|
inlineoverrideprotected |
References SharedPriorityResourceManager< SharedPriorityResourceMediums >::add(), get_resource_manager(), and RESOURCE_PRIORITY_PRIMARY.
|
inlineoverridevirtual |
Run the I/O Service loop within this network thread.
Before running, this method gives the I/O service some work by asynchronously running a deadline timer on
Reimplemented from Horizon::Networking::NetworkThread< ZoneSocket >.
References Horizon::Networking::NetworkThread< SocketType >::run().
|
inlineoverridevirtual |
Initializes the network thread and runs.
Reimplemented from Horizon::Networking::NetworkThread< ZoneSocket >.
References initialize().
Referenced by update().
|
inlineoverridevirtual |
Updates the network thread and schedules a recursive call to itself.
This method is responsible for the following tasks - 1) Issuing a routine to process the new sockets queue. 2) Closes sockets that cannot be updated.
Reimplemented from Horizon::Networking::NetworkThread< ZoneSocket >.
References KernelComponent::calculate_and_set_cpu_load(), KernelComponent::get_system_routine_manager(), KernelComponent::get_thread_cpu_id(), Horizon::System::SystemRoutineManager::process_queue(), KernelComponent::set_thread_cpu_id(), KernelComponent::set_total_execution_time(), start(), and Horizon::Networking::NetworkThread< SocketType >::update().
|
protected |
Referenced by finalize(), and is_finalized().
|
protected |
Referenced by initialize(), and is_initialized().
|
protected |
Referenced by get_resource_manager().