TrinityCore
AsyncAcceptor Class Reference

#include <AsyncAcceptor.h>

Public Types

typedef void(* AcceptCallback) (boost::asio::ip::tcp::socket &&newSocket, uint32 threadIndex)
 

Public Member Functions

 AsyncAcceptor (Trinity::Asio::IoContext &ioContext, std::string const &bindIp, uint16 port)
 
template<class T >
void AsyncAccept ()
 
template<AcceptCallback acceptCallback>
void AsyncAcceptWithCallback ()
 
bool Bind ()
 
void Close ()
 
void SetSocketFactory (std::function< std::pair< boost::asio::ip::tcp::socket *, uint32 >()> func)
 

Private Member Functions

std::pair< boost::asio::ip::tcp::socket *, uint32DefeaultSocketFactory ()
 

Private Attributes

boost::asio::ip::tcp::acceptor _acceptor
 
boost::asio::ip::tcp::endpoint _endpoint
 
boost::asio::ip::tcp::socket _socket
 
std::atomic< bool > _closed
 
std::function< std::pair< boost::asio::ip::tcp::socket *, uint32 >()> _socketFactory
 

Detailed Description

Definition at line 30 of file AsyncAcceptor.h.

Member Typedef Documentation

◆ AcceptCallback

typedef void(* AsyncAcceptor::AcceptCallback) (boost::asio::ip::tcp::socket &&newSocket, uint32 threadIndex)

Definition at line 33 of file AsyncAcceptor.h.

Constructor & Destructor Documentation

◆ AsyncAcceptor()

AsyncAcceptor::AsyncAcceptor ( Trinity::Asio::IoContext ioContext,
std::string const &  bindIp,
uint16  port 
)
inline

Definition at line 35 of file AsyncAcceptor.h.

+ Here is the call graph for this function:

Member Function Documentation

◆ AsyncAccept()

template<class T >
void AsyncAcceptor::AsyncAccept

Definition at line 130 of file AsyncAcceptor.h.

+ Here is the caller graph for this function:

◆ AsyncAcceptWithCallback()

template<AcceptCallback acceptCallback>
void AsyncAcceptor::AsyncAcceptWithCallback ( )
inline

Definition at line 45 of file AsyncAcceptor.h.

+ Here is the caller graph for this function:

◆ Bind()

bool AsyncAcceptor::Bind ( )
inline

Definition at line 72 of file AsyncAcceptor.h.

+ Here is the caller graph for this function:

◆ Close()

void AsyncAcceptor::Close ( )
inline

Definition at line 108 of file AsyncAcceptor.h.

+ Here is the caller graph for this function:

◆ DefeaultSocketFactory()

std::pair< boost::asio::ip::tcp::socket *, uint32 > AsyncAcceptor::DefeaultSocketFactory ( )
inlineprivate

Definition at line 120 of file AsyncAcceptor.h.

+ Here is the caller graph for this function:

◆ SetSocketFactory()

void AsyncAcceptor::SetSocketFactory ( std::function< std::pair< boost::asio::ip::tcp::socket *, uint32 >()>  func)
inline

Definition at line 117 of file AsyncAcceptor.h.

+ Here is the caller graph for this function:

Member Data Documentation

◆ _acceptor

boost::asio::ip::tcp::acceptor AsyncAcceptor::_acceptor
private

Definition at line 122 of file AsyncAcceptor.h.

◆ _closed

std::atomic<bool> AsyncAcceptor::_closed
private

Definition at line 125 of file AsyncAcceptor.h.

◆ _endpoint

boost::asio::ip::tcp::endpoint AsyncAcceptor::_endpoint
private

Definition at line 123 of file AsyncAcceptor.h.

◆ _socket

boost::asio::ip::tcp::socket AsyncAcceptor::_socket
private

Definition at line 124 of file AsyncAcceptor.h.

◆ _socketFactory

std::function<std::pair<boost::asio::ip::tcp::socket*, uint32>()> AsyncAcceptor::_socketFactory
private

Definition at line 126 of file AsyncAcceptor.h.


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