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
 
SocketMgr & operator= (SocketMgr const &)=delete
 
SocketMgr & operator= (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 *, uint32 > GetSocketForAccept ()
 

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()

◆ 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

◆ GetNetworkThreadCount()

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

Definition at line 114 of file SocketMgr.h.

References Trinity::Net::SocketMgr< SocketType >::_threadCount.

◆ GetSocketForAccept()

◆ 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.

References Trinity::Net::SocketMgr< SocketType >::_threads, and TC_LOG_WARN.

◆ 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

◆ StartNetwork()

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

◆ StopNetwork()

◆ Wait()

Member Data Documentation

◆ _acceptor

◆ _threadCount

◆ _threads


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