TrinityCore
Loading...
Searching...
No Matches
WorldSocketMgr Class Reference

Manages all sockets connected to peers and network threads. More...

#include <WorldSocketMgr.h>

+ Inheritance diagram for WorldSocketMgr:

Public Member Functions

bool StartWorldNetwork (Trinity::Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int networkThreads)
 Start network, listen at address:port .
 
void StopNetwork () override
 Stops all network threads, It will wait for all running threads .
 
void OnSocketOpen (Trinity::Net::IoContextTcpSocket &&sock, uint32 threadIndex) override
 
std::size_t GetApplicationSendBufferSize () const
 
- Public Member Functions inherited from Trinity::Net::SocketMgr< WorldSocket >
 SocketMgr (SocketMgr const &)=delete
 
 SocketMgr (SocketMgr &&)=delete
 
SocketMgroperator= (SocketMgr const &)=delete
 
SocketMgroperator= (SocketMgr &&)=delete
 
virtual ~SocketMgr ()
 
virtual bool StartNetwork (Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int threadCount)
 
void Wait ()
 
int32 GetNetworkThreadCount () const
 
uint32 SelectThreadWithMinConnections () const
 
std::pair< IoContextTcpSocket *, uint32GetSocketForAccept ()
 

Static Public Member Functions

static WorldSocketMgrInstance ()
 

Protected Member Functions

 WorldSocketMgr ()
 
Trinity::Net::NetworkThread< WorldSocket > * CreateThreads () const override
 
- Protected Member Functions inherited from Trinity::Net::SocketMgr< WorldSocket >
 SocketMgr ()
 

Private Types

typedef SocketMgr< WorldSocketBaseSocketMgr
 

Private Attributes

int32 _socketSystemSendBufferSize
 
int32 _socketApplicationSendBufferSize
 
bool _tcpNoDelay
 

Additional Inherited Members

- Protected Attributes inherited from Trinity::Net::SocketMgr< WorldSocket >
std::unique_ptr< AsyncAcceptor_acceptor
 
std::unique_ptr< NetworkThread< WorldSocket >[]> _threads
 
int32 _threadCount
 

Detailed Description

Manages all sockets connected to peers and network threads.

Definition at line 26 of file WorldSocketMgr.h.

Member Typedef Documentation

◆ BaseSocketMgr

Definition at line 28 of file WorldSocketMgr.h.

Constructor & Destructor Documentation

◆ WorldSocketMgr()

WorldSocketMgr::WorldSocketMgr ( )
protected

Definition at line 41 of file WorldSocketMgr.cpp.

Member Function Documentation

◆ CreateThreads()

Trinity::Net::NetworkThread< WorldSocket > * WorldSocketMgr::CreateThreads ( ) const
overrideprotectedvirtual

Implements Trinity::Net::SocketMgr< WorldSocket >.

Definition at line 119 of file WorldSocketMgr.cpp.

+ Here is the call graph for this function:

◆ GetApplicationSendBufferSize()

std::size_t WorldSocketMgr::GetApplicationSendBufferSize ( ) const
inline

Definition at line 41 of file WorldSocketMgr.h.

◆ Instance()

WorldSocketMgr & WorldSocketMgr::Instance ( )
static

Definition at line 45 of file WorldSocketMgr.cpp.

◆ OnSocketOpen()

void WorldSocketMgr::OnSocketOpen ( Trinity::Net::IoContextTcpSocket &&  sock,
uint32  threadIndex 
)
overridevirtual

Reimplemented from Trinity::Net::SocketMgr< WorldSocket >.

Definition at line 88 of file WorldSocketMgr.cpp.

+ Here is the caller graph for this function:

◆ StartWorldNetwork()

bool WorldSocketMgr::StartWorldNetwork ( Trinity::Asio::IoContext ioContext,
std::string const &  bindIp,
uint16  port,
int  networkThreads 
)

Start network, listen at address:port .

Definition at line 51 of file WorldSocketMgr.cpp.

+ Here is the call graph for this function:

◆ StopNetwork()

void WorldSocketMgr::StopNetwork ( )
overridevirtual

Stops all network threads, It will wait for all running threads .

Reimplemented from Trinity::Net::SocketMgr< WorldSocket >.

Definition at line 81 of file WorldSocketMgr.cpp.

Member Data Documentation

◆ _socketApplicationSendBufferSize

int32 WorldSocketMgr::_socketApplicationSendBufferSize
private

Definition at line 50 of file WorldSocketMgr.h.

◆ _socketSystemSendBufferSize

int32 WorldSocketMgr::_socketSystemSendBufferSize
private

Definition at line 49 of file WorldSocketMgr.h.

◆ _tcpNoDelay

bool WorldSocketMgr::_tcpNoDelay
private

Definition at line 51 of file WorldSocketMgr.h.


The documentation for this class was generated from the following files: