![]() |
Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
The client end of a network session. More...
#include <NetClientSession.h>

Public Member Functions | |
| CNetClientSession (CNetClient &client) | |
| ~CNetClientSession () | |
| bool | Connect (const CStr &server, const std::uint16_t port, ENetHost *enetClient) |
| void | Shutdown () |
| Shut down the net session. More... | |
| void | ProcessPolledMessages () |
| Processes pending messages. More... | |
| bool | SendMessage (const CNetMessage *message) |
| Queue up a message to send to the server on the next Loop() call. More... | |
| std::uint32_t | GetLastReceivedTime () const |
| Number of milliseconds since the most recent packet of the server was received. More... | |
| std::uint32_t | GetMeanRTT () const |
| Average round trip time to the server. More... | |
| CNetFileTransferer & | GetFileTransferer () |
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 {16} |
| boost::lockfree::queue< ENetPacket * > | m_OutgoingMessages {16} |
| bool | m_Connected {false} |
| bool | m_WasConnected {false} |
| std::atomic< std::uint32_t > | m_LastReceivedTime {0} |
| std::atomic< std::uint32_t > | m_MeanRTT {0} |
| std::atomic< bool > | m_LoopRunning {false} |
| std::atomic< bool > | m_ShouldShutdown {false} |
| std::unique_ptr< ENetHost, DestroyHost > | m_Host |
| std::unique_ptr< ENetPeer, DestroyPeer > | m_Server |
| std::unique_ptr< 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 | ( | ) |
| bool CNetClientSession::Connect | ( | const CStr & | server, |
| const std::uint16_t | port, | ||
| ENetHost * | enetClient | ||
| ) |
|
private |
Flush queued outgoing network messages.
|
inline |
| std::uint32_t CNetClientSession::GetLastReceivedTime | ( | ) | const |
Number of milliseconds since the most recent packet of the server was received.
| std::uint32_t 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.
| bool CNetClientSession::SendMessage | ( | const CNetMessage * | message | ) |
Queue up a message to send to the server on the next Loop() call.
| void CNetClientSession::Shutdown | ( | ) |
Shut down the net session.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |