TrinityCore
WorldSocketMgr Class Reference

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

#include <WorldSocketMgr.h>

+ Inheritance diagram for WorldSocketMgr:

Public Member Functions

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

Static Public Member Functions

static WorldSocketMgrInstance ()
 

Protected Member Functions

 WorldSocketMgr ()
 
NetworkThread< WorldSocket > * CreateThreads () const override
 
- Protected Member Functions inherited from SocketMgr< WorldSocket >
 SocketMgr ()
 
virtual NetworkThread< WorldSocket > * CreateThreads () const=0
 

Private Types

typedef SocketMgr< WorldSocketBaseSocketMgr
 

Private Member Functions

bool StartNetwork (Trinity::Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int threadCount) override
 

Private Attributes

AsyncAcceptor_instanceAcceptor
 
int32 _socketSystemSendBufferSize
 
int32 _socketApplicationSendBufferSize
 
bool _tcpNoDelay
 

Additional Inherited Members

- Protected Attributes inherited from SocketMgr< WorldSocket >
AsyncAcceptor_acceptor
 
NetworkThread< WorldSocket > * _threads
 
int32 _threadCount
 

Detailed Description

Manages all sockets connected to peers and network threads.

Definition at line 32 of file WorldSocketMgr.h.

Member Typedef Documentation

◆ BaseSocketMgr

Definition at line 34 of file WorldSocketMgr.h.

Constructor & Destructor Documentation

◆ ~WorldSocketMgr()

WorldSocketMgr::~WorldSocketMgr ( )

Definition at line 49 of file WorldSocketMgr.cpp.

◆ WorldSocketMgr()

WorldSocketMgr::WorldSocketMgr ( )
protected

Definition at line 45 of file WorldSocketMgr.cpp.

Member Function Documentation

◆ CreateThreads()

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

Implements SocketMgr< WorldSocket >.

Definition at line 154 of file WorldSocketMgr.cpp.

+ Here is the call graph for this function:

◆ GetApplicationSendBufferSize()

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

Definition at line 49 of file WorldSocketMgr.h.

◆ Instance()

WorldSocketMgr & WorldSocketMgr::Instance ( )
static

Definition at line 54 of file WorldSocketMgr.cpp.

◆ OnSocketOpen()

void WorldSocketMgr::OnSocketOpen ( boost::asio::ip::tcp::socket &&  sock,
uint32  threadIndex 
)
overridevirtual

Reimplemented from SocketMgr< WorldSocket >.

Definition at line 123 of file WorldSocketMgr.cpp.

+ Here is the call graph for this function:

◆ StartNetwork()

bool WorldSocketMgr::StartNetwork ( Trinity::Asio::IoContext ioContext,
std::string const &  bindIp,
uint16  port,
int  threadCount 
)
inlineoverrideprivatevirtual

Reimplemented from SocketMgr< WorldSocket >.

Definition at line 58 of file WorldSocketMgr.h.

◆ StartWorldNetwork()

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

Start network, listen at address:port .

Definition at line 60 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 SocketMgr< WorldSocket >.

Definition at line 110 of file WorldSocketMgr.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ _instanceAcceptor

AsyncAcceptor* WorldSocketMgr::_instanceAcceptor
private

Definition at line 63 of file WorldSocketMgr.h.

◆ _socketApplicationSendBufferSize

int32 WorldSocketMgr::_socketApplicationSendBufferSize
private

Definition at line 65 of file WorldSocketMgr.h.

◆ _socketSystemSendBufferSize

int32 WorldSocketMgr::_socketSystemSendBufferSize
private

Definition at line 64 of file WorldSocketMgr.h.

◆ _tcpNoDelay

bool WorldSocketMgr::_tcpNoDelay
private

Definition at line 66 of file WorldSocketMgr.h.


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