TrinityCore
Loading...
Searching...
No Matches
Trinity::Net::SocketMgr< SocketType > Class Template Referenceabstract

#include <SocketMgr.h>

Public Member Functions

 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)
 
virtual void StopNetwork ()
 
void Wait ()
 
virtual void OnSocketOpen (IoContextTcpSocket &&sock, uint32 threadIndex)
 
int32 GetNetworkThreadCount () const
 
uint32 SelectThreadWithMinConnections () const
 
std::pair< IoContextTcpSocket *, uint32GetSocketForAccept ()
 

Protected Member Functions

 SocketMgr ()
 
virtual NetworkThread< SocketType > * CreateThreads () const =0
 

Protected Attributes

std::unique_ptr< AsyncAcceptor_acceptor
 
std::unique_ptr< NetworkThread< SocketType >[]> _threads
 
int32 _threadCount
 

Detailed Description

template<class SocketType>
class Trinity::Net::SocketMgr< SocketType >

Definition at line 31 of file SocketMgr.h.

Constructor & Destructor Documentation

◆ SocketMgr() [1/3]

template<class SocketType >
Trinity::Net::SocketMgr< SocketType >::SocketMgr ( SocketMgr< SocketType > const &  )
delete

◆ SocketMgr() [2/3]

template<class SocketType >
Trinity::Net::SocketMgr< SocketType >::SocketMgr ( SocketMgr< SocketType > &&  )
delete

◆ ~SocketMgr()

template<class SocketType >
virtual Trinity::Net::SocketMgr< SocketType >::~SocketMgr ( )
inlinevirtual

Definition at line 39 of file SocketMgr.h.

◆ SocketMgr() [3/3]

template<class SocketType >
Trinity::Net::SocketMgr< SocketType >::SocketMgr ( )
inlineprotected

Definition at line 134 of file SocketMgr.h.

Member Function Documentation

◆ CreateThreads()

template<class SocketType >
virtual NetworkThread< SocketType > * Trinity::Net::SocketMgr< SocketType >::CreateThreads ( ) const
protectedpure virtual

Implemented in AuthSocketMgr, and WorldSocketMgr.

+ Here is the caller graph for this function:

◆ GetNetworkThreadCount()

template<class SocketType >
int32 Trinity::Net::SocketMgr< SocketType >::GetNetworkThreadCount ( ) const
inline

Definition at line 114 of file SocketMgr.h.

◆ GetSocketForAccept()

template<class SocketType >
std::pair< IoContextTcpSocket *, uint32 > Trinity::Net::SocketMgr< SocketType >::GetSocketForAccept ( )
inline

Definition at line 127 of file SocketMgr.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnSocketOpen()

template<class SocketType >
virtual void Trinity::Net::SocketMgr< SocketType >::OnSocketOpen ( IoContextTcpSocket &&  sock,
uint32  threadIndex 
)
inlinevirtual

Reimplemented in WorldSocketMgr.

Definition at line 99 of file SocketMgr.h.

◆ operator=() [1/2]

template<class SocketType >
SocketMgr & Trinity::Net::SocketMgr< SocketType >::operator= ( SocketMgr< SocketType > &&  )
delete

◆ operator=() [2/2]

template<class SocketType >
SocketMgr & Trinity::Net::SocketMgr< SocketType >::operator= ( SocketMgr< SocketType > const &  )
delete

◆ SelectThreadWithMinConnections()

template<class SocketType >
uint32 Trinity::Net::SocketMgr< SocketType >::SelectThreadWithMinConnections ( ) const
inline

Definition at line 116 of file SocketMgr.h.

+ Here is the caller graph for this function:

◆ StartNetwork()

template<class SocketType >
virtual bool Trinity::Net::SocketMgr< SocketType >::StartNetwork ( Asio::IoContext ioContext,
std::string const &  bindIp,
uint16  port,
int  threadCount 
)
inlinevirtual

Reimplemented in AuthSocketMgr.

Definition at line 44 of file SocketMgr.h.

+ Here is the call graph for this function:

◆ StopNetwork()

template<class SocketType >
virtual void Trinity::Net::SocketMgr< SocketType >::StopNetwork ( )
inlinevirtual

Reimplemented in WorldSocketMgr.

Definition at line 79 of file SocketMgr.h.

+ Here is the call graph for this function:

◆ Wait()

template<class SocketType >
void Trinity::Net::SocketMgr< SocketType >::Wait ( )
inline

Definition at line 93 of file SocketMgr.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _acceptor

template<class SocketType >
std::unique_ptr<AsyncAcceptor> Trinity::Net::SocketMgr< SocketType >::_acceptor
protected

Definition at line 140 of file SocketMgr.h.

◆ _threadCount

template<class SocketType >
int32 Trinity::Net::SocketMgr< SocketType >::_threadCount
protected

Definition at line 142 of file SocketMgr.h.

◆ _threads

template<class SocketType >
std::unique_ptr<NetworkThread<SocketType>[]> Trinity::Net::SocketMgr< SocketType >::_threads
protected

Definition at line 141 of file SocketMgr.h.


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