18 #ifndef NetworkThread_h__
19 #define NetworkThread_h__
25 #include <boost/asio/ip/tcp.hpp>
26 #include <boost/asio/deadline_timer.hpp>
34 using boost::asio::ip::tcp;
36 template<
class SocketType>
84 virtual void AddSocket(std::shared_ptr<SocketType> sock)
106 for (std::shared_ptr<SocketType> sock :
_newSockets)
178 #endif // NetworkThread_h__
boost::asio::io_service _io_service
Definition: NetworkThread.h:173
virtual void AddSocket(std::shared_ptr< SocketType > sock)
Definition: NetworkThread.h:84
int32 GetConnectionCount() const
Definition: NetworkThread.h:79
SocketContainer _newSockets
Definition: NetworkThread.h:171
void Run()
Definition: NetworkThread.h:120
#define false
Definition: CascPort.h:18
std::atomic< bool > _stopped
Definition: NetworkThread.h:164
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
void Update()
Definition: NetworkThread.h:133
NetworkThread()
Definition: NetworkThread.h:40
SocketContainer _sockets
Definition: NetworkThread.h:168
void Wait()
Definition: NetworkThread.h:70
std::atomic< int32 > _connections
Definition: NetworkThread.h:163
virtual ~NetworkThread()
Definition: NetworkThread.h:45
void Stop()
Definition: NetworkThread.h:55
Definition: NetworkThread.h:37
std::vector< std::shared_ptr< SocketType > > SocketContainer
Definition: NetworkThread.h:161
std::thread * _thread
Definition: NetworkThread.h:166
tcp::socket _acceptSocket
Definition: NetworkThread.h:174
std::mutex _newSocketsLock
Definition: NetworkThread.h:170
int32_t int32
Definition: Define.h:146
virtual void SocketRemoved(std::shared_ptr< SocketType >)
Definition: NetworkThread.h:97
boost::asio::deadline_timer _updateTimer
Definition: NetworkThread.h:175
float milliseconds()
Definition: units.h:92
void AddNewSockets()
Definition: NetworkThread.h:99
#define ASSERT
Definition: Errors.h:55
bool Start()
Definition: NetworkThread.h:61
virtual void SocketAdded(std::shared_ptr< SocketType >)
Definition: NetworkThread.h:96
tcp::socket * GetSocketForAccept()
Definition: NetworkThread.h:93