18#ifndef TRINITYCORE_NETWORK_THREAD_H
19#define TRINITYCORE_NETWORK_THREAD_H
34template<
class SocketType,
class DerivedThread>
94 virtual void SocketAdded(std::shared_ptr<SocketType>
const& ) { }
104 for (std::shared_ptr<SocketType>& sock :
_newSockets)
112 _sockets.emplace_back(std::move(sock));
148 static_cast<DerivedThread*>(this)->SocketRemoved(sock);
150 --this->_connections;
#define TC_LOG_DEBUG(filterType__, message__,...)
Trinity::Asio::IoContext * GetIoContext()
NetworkThread(NetworkThread const &)=delete
SocketContainer _newSockets
std::mutex _newSocketsLock
NetworkThread & operator=(NetworkThread &&)=delete
NetworkThread(NetworkThread &&)=delete
int32 GetConnectionCount() const
virtual void SocketRemoved(std::shared_ptr< SocketType > const &)
Trinity::Asio::DeadlineTimer _updateTimer
std::atomic< bool > _stopped
std::vector< std::shared_ptr< SocketType > > SocketContainer
NetworkThread & operator=(NetworkThread const &)=delete
void AddSocket(std::shared_ptr< SocketType > &&sock)
std::atomic< int32 > _connections
std::unique_ptr< std::thread > _thread
virtual void SocketAdded(std::shared_ptr< SocketType > const &)
Trinity::Asio::IoContext _ioContext
constexpr void EraseIf(Container &c, Predicate p)