Horizon Official Technical Documentation
|
|
Manager of client sockets. More...
#include <ClientSocketMgr.hpp>
Public Member Functions | |
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. More... | |
bool | stop () |
void | update_sessions (uint64_t time) |
![]() | |
virtual 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. More... | |
virtual bool | stop_network () override |
Stop the Acceptor network and clear the client socket map. More... | |
void | on_socket_open (std::shared_ptr< tcp::socket > const &socket, uint32_t thread_index) |
On Socket Open / Start Event. More... | |
void | set_socket_for_removal (std::weak_ptr< ZoneSocket > sock) |
Sets a socket for removal on the next session update call. More... | |
void | set_socket_for_management (std::shared_ptr< ZoneSocket > sock) |
void | manage_sockets (uint32_t time) |
Updates every session in the socket map and removes ones in the removal queue. More... | |
SocketMap & | get_sockets () |
![]() | |
virtual | ~SocketMgr () |
virtual bool | StartNetworkThreads (uint32_t threads=1) |
Main function that deals with network thread initiation. More... | |
virtual bool | stop_network () |
Stops network threads and clears the thread map. More... | |
uint32_t | GetNetworkThreadCount () const |
Get the current size of the thread map. More... | |
uint32_t | SelectThreadWithMinConnections () const |
Select the thread with the least number of connections, for new socket additions. More... | |
std::shared_ptr< ZoneSocket > | on_socket_open (std::shared_ptr< tcp::socket > const &socket, uint32_t thread_index) |
On Socket Open / Start Routine. More... | |
std::pair< std::shared_ptr< tcp::socket >, uint32_t > | get_new_socket () |
Get a socket from the thread for new server connection. More... | |
network_thread_map & | get_thread_map () |
Private Types | |
typedef Horizon::Networking::AcceptSocketMgr< ZoneSocket, ZoneNetworkThread > | BaseSocketMgr |
Manager of client sockets.
|
private |
|
virtual |
Initialize and start accepting connections asynchronously.
This method also starts the networking threads for accepted sockets.
[in|out] | &io_context const reference to the io_context object. | |
[in|out] | &listen_ip const reference to the ip_address string for the acceptor to bind on. | |
[in] | port | port number for the acceptor to bind on. |
[in] | threads | number of network acceptor threads to start and run. |
Reimplemented from Horizon::Networking::AcceptSocketMgr< ZoneSocket, ZoneNetworkThread >.
References Horizon::System::RUNTIME_NETWORKING, and sZone.
bool Horizon::Zone::ClientSocketMgr::stop | ( | ) |
References Horizon::System::RUNTIME_NETWORKING, and sZone.
Referenced by Horizon::Zone::ZoneServer::update().
|
inline |
References Horizon::Networking::AcceptSocketMgr< ZoneSocket, ZoneNetworkThread >::get_sockets().