AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
AuthSocketMgr Class Reference

#include "AuthSocketMgr.h"

Inheritance diagram for AuthSocketMgr:
SocketMgr< AuthSession >

Public Member Functions

bool StartNetwork (Acore::Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int threadCount=1) override
 
- Public Member Functions inherited from SocketMgr< AuthSession >
virtual ~SocketMgr ()
 
virtual bool StartNetwork (Acore::Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int threadCount)
 
virtual void StopNetwork ()
 
void Wait ()
 
virtual void OnSocketOpen (tcp::socket &&sock, uint32 threadIndex)
 
int32 GetNetworkThreadCount () const
 
uint32 SelectThreadWithMinConnections () const
 
std::pair< tcp::socket *, uint32GetSocketForAccept ()
 

Static Public Member Functions

static AuthSocketMgrInstance ()
 

Protected Member Functions

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

Static Protected Member Functions

static void OnSocketAccept (tcp::socket &&sock, uint32 threadIndex)
 

Private Types

typedef SocketMgr< AuthSessionBaseSocketMgr
 

Additional Inherited Members

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

Detailed Description

Member Typedef Documentation

◆ BaseSocketMgr

Member Function Documentation

◆ CreateThreads()

NetworkThread< AuthSession > * AuthSocketMgr::CreateThreads ( ) const
inlineoverrideprotectedvirtual

Implements SocketMgr< AuthSession >.

46 {
47 return new NetworkThread<AuthSession>[1];
48 }
Definition: NetworkThread.h:39

◆ Instance()

static AuthSocketMgr & AuthSocketMgr::Instance ( )
inlinestatic
30 {
31 static AuthSocketMgr instance;
32 return instance;
33 }
Definition: AuthSocketMgr.h:25

Referenced by OnSocketAccept().

◆ OnSocketAccept()

static void AuthSocketMgr::OnSocketAccept ( tcp::socket &&  sock,
uint32  threadIndex 
)
inlinestaticprotected
51 {
52 Instance().OnSocketOpen(std::forward<tcp::socket>(sock), threadIndex);
53 }
static AuthSocketMgr & Instance()
Definition: AuthSocketMgr.h:29
virtual void OnSocketOpen(tcp::socket &&sock, uint32 threadIndex)
Definition: SocketMgr.h:92

References Instance(), and SocketMgr< SocketType >::OnSocketOpen().

Referenced by StartNetwork().

◆ StartNetwork()

bool AuthSocketMgr::StartNetwork ( Acore::Asio::IoContext ioContext,
std::string const &  bindIp,
uint16  port,
int  threadCount = 1 
)
inlineoverridevirtual

Reimplemented from SocketMgr< AuthSession >.

36 {
37 if (!BaseSocketMgr::StartNetwork(ioContext, bindIp, port, threadCount))
38 return false;
39
40 _acceptor->AsyncAcceptWithCallback<&AuthSocketMgr::OnSocketAccept>();
41 return true;
42 }
static void OnSocketAccept(tcp::socket &&sock, uint32 threadIndex)
Definition: AuthSocketMgr.h:50
virtual bool StartNetwork(Acore::Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int threadCount)
Definition: SocketMgr.h:38
std::unique_ptr< AsyncAcceptor > _acceptor
Definition: SocketMgr.h:131

References SocketMgr< AuthSession >::_acceptor, OnSocketAccept(), and SocketMgr< AuthSession >::StartNetwork().