Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
The client end of a network session. More...
#include <NetSession.h>
Public Member Functions | |
CNetClientSession (CNetClient &client) | |
~CNetClientSession () | |
bool | Connect (const CStr &server, const u16 port, ENetHost *enetClient) |
void | Shutdown () |
Shut down the net session. More... | |
void | ProcessPolledMessages () |
Processes pending messages. More... | |
virtual bool | SendMessage (const CNetMessage *message) override |
Queue up a message to send to the server on the next Loop() call. More... | |
u32 | GetLastReceivedTime () const |
Number of milliseconds since the most recent packet of the server was received. More... | |
u32 | GetMeanRTT () const |
Average round trip time to the server. More... | |
CNetFileTransferer & | GetFileTransferer () |
Public Member Functions inherited from INetSession | |
virtual | ~INetSession () |
virtual bool | SendMessage (const CNetMessage *message)=0 |
Static Public Member Functions | |
static void | RunNetLoop (CNetClientSession *session) |
The client NetSession is threaded to avoid getting timeouts if the main thread hangs. More... | |
Private Member Functions | |
NONCOPYABLE (CNetClientSession) | |
void | Poll () |
Process queued incoming messages. More... | |
void | Flush () |
Flush queued outgoing network messages. More... | |
Private Attributes | |
CNetClient & | m_Client |
CNetFileTransferer | m_FileTransferer |
boost::lockfree::queue< ENetEvent > | m_IncomingMessages |
boost::lockfree::queue< ENetPacket * > | m_OutgoingMessages |
bool | m_Connected = false |
std::atomic< u32 > | m_LastReceivedTime |
std::atomic< u32 > | m_MeanRTT |
std::atomic< bool > | m_LoopRunning |
std::atomic< bool > | m_ShouldShutdown |
ENetHost * | m_Host |
ENetPeer * | m_Server |
CNetStatsTable * | m_Stats |
The client end of a network session.
Provides an abstraction of the network interface, allowing communication with the server. The NetClientSession is threaded, so all calls to the public interface must be thread-safe.
CNetClientSession::CNetClientSession | ( | CNetClient & | client | ) |
CNetClientSession::~CNetClientSession | ( | ) |
|
private |
Flush queued outgoing network messages.
|
inline |
u32 CNetClientSession::GetLastReceivedTime | ( | ) | const |
Number of milliseconds since the most recent packet of the server was received.
u32 CNetClientSession::GetMeanRTT | ( | ) | const |
Average round trip time to the server.
|
private |
|
private |
Process queued incoming messages.
void CNetClientSession::ProcessPolledMessages | ( | ) |
Processes pending messages.
|
static |
The client NetSession is threaded to avoid getting timeouts if the main thread hangs.
Call Connect() before starting this loop.
|
overridevirtual |
Queue up a message to send to the server on the next Loop() call.
Implements INetSession.
void CNetClientSession::Shutdown | ( | ) |
Shut down the net session.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |