18#ifndef TRINITYCORE_NETWORK_THREAD_H
19#define TRINITYCORE_NETWORK_THREAD_H
29#include <boost/asio/ip/tcp.hpp>
39template<
class SocketType>
88 virtual void AddSocket(std::shared_ptr<SocketType> sock)
99 virtual void SocketAdded(std::shared_ptr<SocketType>
const& ) { }
109 for (std::shared_ptr<SocketType>& sock :
_newSockets)
117 _sockets.emplace_back(std::move(sock));
153 this->SocketRemoved(sock);
155 --this->_connections;
#define TC_LOG_DEBUG(filterType__,...)
virtual void AddSocket(std::shared_ptr< SocketType > sock)
NetworkThread & operator=(NetworkThread &&)=delete
Trinity::Asio::IoContext _ioContext
NetworkThread(NetworkThread const &)=delete
Trinity::Asio::DeadlineTimer _updateTimer
SocketContainer _newSockets
Trinity::Net::IoContextTcpSocket * GetSocketForAccept()
NetworkThread & operator=(NetworkThread const &)=delete
virtual void SocketAdded(std::shared_ptr< SocketType > const &)
std::mutex _newSocketsLock
int32 GetConnectionCount() const
std::atomic< int32 > _connections
std::unique_ptr< std::thread > _thread
std::atomic< bool > _stopped
Trinity::Net::IoContextTcpSocket _acceptSocket
NetworkThread(NetworkThread &&)=delete
std::vector< std::shared_ptr< SocketType > > SocketContainer
virtual void SocketRemoved(std::shared_ptr< SocketType > const &)
void EraseIf(Container &c, Predicate p)
boost::asio::basic_stream_socket< boost::asio::ip::tcp, boost::asio::io_context::executor_type > IoContextTcpSocket