TrinityCore
|
#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 | AsyncReadWithCallback (void(T::*callback)(boost::system::error_code, std::size_t)) |
void | QueuePacket (MessageBuffer &&buffer) |
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) |
Stream & | underlying_stream () |
Private Member Functions | |
void | ReadHandlerInternal (boost::system::error_code error, size_t transferredBytes) |
void | WriteHandlerWrapper (boost::system::error_code, std::size_t) |
bool | HandleQueue () |
Private Attributes | |
Stream | _socket |
boost::asio::ip::address | _remoteAddress |
uint16 | _remotePort |
MessageBuffer | _readBuffer |
std::queue< MessageBuffer > | _writeQueue |
std::atomic< bool > | _closed |
std::atomic< bool > | _closing |
bool | _isWritingAsync |
Base async socket implementation
T | derived class type (CRTP) |
Stream | stream type used for operations on socket Stream must implement the following methods: |
void close(boost::system::error_code& error);
void shutdown(boost::asio::socket_base::shutdown_type what, boost::system::error_code& shutdownError);
template<typename MutableBufferSequence, typename ReadHandlerType> void async_read_some(MutableBufferSequence const& buffers, ReadHandlerType&& handler);
template<typename ConstBufferSequence, typename WriteHandlerType> void async_write_some(ConstBufferSequence const& buffers, WriteHandlerType&& handler);
template<typename ConstBufferSequence> std::size_t write_some(ConstBufferSequence const& buffers, boost::system::error_code& error);
template<typename SettableSocketOption> void set_option(SettableSocketOption const& option, boost::system::error_code& error);
tcp::socket::endpoint_type remote_endpoint() const;
|
inlineexplicit |
|
inlinevirtual |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inline |
Marks the socket for closing after write buffer becomes empty.
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprotectedvirtual |
|
inline |
|
protectedpure virtual |
|
inlineprivate |
|
inlineprotected |
|
pure virtual |
Implemented in Battlenet::Session, and WorldSocket.
|
inlineprotected |
|
inlinevirtual |
Reimplemented in Battlenet::Session, and WorldSocket.
|
inlineprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |