AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "Socket.h"
Public Member Functions | |
Socket (tcp::socket &&socket) | |
virtual | ~Socket () |
virtual void | Start ()=0 |
virtual bool | Update () |
boost::asio::ip::address | GetRemoteIpAddress () const |
uint16 | GetRemotePort () const |
void | AsyncRead () |
void | AsyncReadProxyHeader () |
void | AsyncReadWithCallback (void(T::*callback)(boost::system::error_code, std::size_t)) |
void | QueuePacket (MessageBuffer &&buffer) |
ProxyHeaderReadingState | GetProxyHeaderReadingState () const |
bool | IsOpen () const |
void | CloseSocket () |
void | DelayedCloseSocket () |
Marks the socket for closing after write buffer becomes empty. More... | |
MessageBuffer & | GetReadBuffer () |
Protected Member Functions | |
virtual void | OnClose () |
virtual void | ReadHandler ()=0 |
bool | AsyncProcessQueue () |
void | SetNoDelay (bool enable) |
Private Member Functions | |
void | ReadHandlerInternal (boost::system::error_code error, std::size_t transferredBytes) |
void | ProxyReadHeaderHandler (boost::system::error_code error, std::size_t transferredBytes) |
void | WriteHandlerWrapper (boost::system::error_code, std::size_t) |
bool | HandleQueue () |
Private Attributes | |
tcp::socket | _socket |
boost::asio::ip::address | _remoteAddress |
uint16 | _remotePort |
MessageBuffer | _readBuffer |
std::queue< MessageBuffer > | _writeQueue |
std::atomic< bool > | _closed |
std::atomic< bool > | _closing |
bool | _isWritingAsync |
ProxyHeaderReadingState | _proxyHeaderReadingState |
References Socket< T >::_readBuffer, READ_BLOCK_SIZE, and MessageBuffer::Resize().
References Socket< T >::_closed, and Socket< T >::_socket.
|
inlineprotected |
References Socket< T >::_isWritingAsync, Socket< T >::_socket, Socket< T >::_writeQueue, MessageBuffer::GetActiveSize(), and MessageBuffer::GetReadPointer().
Referenced by Socket< T >::HandleQueue(), and Socket< T >::QueuePacket().
|
inline |
References Socket< T >::_readBuffer, Socket< T >::_socket, MessageBuffer::EnsureFreeSpace(), MessageBuffer::GetRemainingSpace(), MessageBuffer::GetWritePointer(), Socket< T >::IsOpen(), and MessageBuffer::Normalize().
|
inline |
References Socket< T >::_proxyHeaderReadingState, Socket< T >::_readBuffer, Socket< T >::_socket, MessageBuffer::EnsureFreeSpace(), MessageBuffer::GetRemainingSpace(), MessageBuffer::GetWritePointer(), Socket< T >::IsOpen(), MessageBuffer::Normalize(), and PROXY_HEADER_READING_STATE_STARTED.
Referenced by Socket< T >::ProxyReadHeaderHandler().
|
inline |
References Socket< T >::_readBuffer, Socket< T >::_socket, MessageBuffer::EnsureFreeSpace(), MessageBuffer::GetRemainingSpace(), MessageBuffer::GetWritePointer(), Socket< T >::IsOpen(), and MessageBuffer::Normalize().
|
inline |
References Socket< T >::_closed, Socket< T >::_socket, Socket< T >::GetRemoteIpAddress(), LOG_DEBUG, and Socket< T >::OnClose().
Referenced by Socket< T >::HandleQueue(), Socket< T >::ProxyReadHeaderHandler(), and Socket< T >::ReadHandlerInternal().
|
inline |
|
inline |
References Socket< T >::_proxyHeaderReadingState.
|
inline |
|
inline |
References Socket< T >::_remoteAddress.
Referenced by Socket< T >::CloseSocket(), Socket< T >::ProxyReadHeaderHandler(), and Socket< T >::SetNoDelay().
References Socket< T >::_remotePort.
|
inlineprivate |
References Socket< T >::_closing, Socket< T >::_socket, Socket< T >::_writeQueue, Socket< T >::AsyncProcessQueue(), Socket< T >::CloseSocket(), MessageBuffer::GetActiveSize(), MessageBuffer::GetReadPointer(), and MessageBuffer::ReadCompleted().
Referenced by Socket< T >::Update(), and Socket< T >::WriteHandlerWrapper().
|
inline |
References Socket< T >::_closed, and Socket< T >::_closing.
Referenced by Socket< T >::AsyncRead(), Socket< T >::AsyncReadProxyHeader(), and Socket< T >::AsyncReadWithCallback().
|
inlineprotectedvirtual |
|
inlineprivate |
References Socket< T >::_proxyHeaderReadingState, Socket< T >::_readBuffer, Socket< T >::_remoteAddress, Socket< T >::_remotePort, Socket< T >::AsyncReadProxyHeader(), Socket< T >::CloseSocket(), MessageBuffer::GetActiveSize(), Socket< T >::GetReadBuffer(), MessageBuffer::GetReadPointer(), Socket< T >::GetRemoteIpAddress(), LOG_ERROR, PROXY_HEADER_ADDRESS_FAMILY_AND_PROTOCOL_TCP_V4, PROXY_HEADER_ADDRESS_FAMILY_AND_PROTOCOL_TCP_V6, PROXY_HEADER_READING_STATE_FAILED, PROXY_HEADER_READING_STATE_FINISHED, MessageBuffer::ReadCompleted(), and MessageBuffer::WriteCompleted().
|
inline |
References Socket< T >::_writeQueue, and Socket< T >::AsyncProcessQueue().
|
protectedpure virtual |
Implemented in AuthSession, and WorldSocket.
Referenced by Socket< T >::ReadHandlerInternal().
|
inlineprivate |
References Socket< T >::_readBuffer, Socket< T >::CloseSocket(), Socket< T >::ReadHandler(), and MessageBuffer::WriteCompleted().
|
inlineprotected |
References Socket< T >::_socket, Socket< T >::GetRemoteIpAddress(), and LOG_DEBUG.
|
pure virtual |
Implemented in AuthSession, and WorldSocket.
|
inlinevirtual |
Reimplemented in AuthSession, and WorldSocket.
References Socket< T >::_closed, Socket< T >::_closing, Socket< T >::_isWritingAsync, Socket< T >::_writeQueue, and Socket< T >::HandleQueue().
|
inlineprivate |
References Socket< T >::_isWritingAsync, and Socket< T >::HandleQueue().
|
private |
Referenced by Socket< T >::CloseSocket(), Socket< T >::IsOpen(), Socket< T >::Update(), and Socket< T >::~Socket().
|
private |
|
private |
Referenced by Socket< T >::AsyncProcessQueue(), Socket< T >::Update(), and Socket< T >::WriteHandlerWrapper().
|
private |
|
private |
|
private |
Referenced by Socket< T >::GetRemoteIpAddress(), and Socket< T >::ProxyReadHeaderHandler().
Referenced by Socket< T >::GetRemotePort(), and Socket< T >::ProxyReadHeaderHandler().
|
private |
|
private |