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

47 {
49
50 bool proxyProtocolEnabled = sConfigMgr->GetOption<bool>("EnableProxyProtocol", false, true);
51 if (proxyProtocolEnabled)
52 threads[0].EnableProxyProtocol();
53
54 return threads;
55 }
#define sConfigMgr
Definition: Config.h:74
Definition: NetworkThread.h:38
void EnableProxyProtocol()
Definition: NetworkThread.h:96

References NetworkThread< SocketType >::EnableProxyProtocol(), and sConfigMgr.

◆ Instance()

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

Referenced by OnSocketAccept().

◆ OnSocketAccept()

static void AuthSocketMgr::OnSocketAccept ( tcp::socket &&  sock,
uint32  threadIndex 
)
inlinestaticprotected
58 {
59 Instance().OnSocketOpen(std::forward<tcp::socket>(sock), threadIndex);
60 }
static AuthSocketMgr & Instance()
Definition: AuthSocketMgr.h:30
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 >.

37 {
38 if (!BaseSocketMgr::StartNetwork(ioContext, bindIp, port, threadCount))
39 return false;
40
41 _acceptor->AsyncAcceptWithCallback<&AuthSocketMgr::OnSocketAccept>();
42 return true;
43 }
static void OnSocketAccept(tcp::socket &&sock, uint32 threadIndex)
Definition: AuthSocketMgr.h:57
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:129

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