Open 3D Engine GridMate API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Classes | Public Member Functions | List of all members
GridMate::DefaultTrafficControl Class Reference

#include <DefaultTrafficControl.h>

Inherits GridMate::TrafficControl.

Public Member Functions

 GM_CLASS_ALLOCATOR (DefaultTrafficControl)
 
 DefaultTrafficControl (unsigned int maxSystemPacketSize, float rttConnectionThreshold, float packetLossThreshold, unsigned int maxRecvPackets)
 maxSystemPacketSize in bytes and datagramOverhead in bytes (used for effective statistics)
 
void OnConnect (TrafficControlConnectionId id, const AZStd::intrusive_ptr< DriverAddress > &address) override
 Called when Carrier has established a new connection.
 
void OnDisconnect (TrafficControlConnectionId id) override
 Called when Carrier has lost a connection.
 
void OnHandshakeComplete (TrafficControlConnectionId id) override
 Called when Carrier completed successful handshake. Usually NAT punch happens during the handshake, which can result is high packet loss.
 
void OnSend (TrafficControlConnectionId id, DataGramControlData &info) override
 Called when Carrier has send a package.
 
void OnSendAck (TrafficControlConnectionId id) override
 Called when Carrier has send an ACK/NACK data with the packet.
 
void OnReSend (TrafficControlConnectionId id, DataGramControlData &info, unsigned int resendDataSize) override
 Called when Carrier has resend a package.
 
void OnAck (TrafficControlConnectionId id, DataGramControlData &info, bool &windowChange) override
 Called when Carrier confirmed a package delivery.
 
void OnNAck (TrafficControlConnectionId id, DataGramControlData &info) override
 Called when we receive a NAck for a package delivery.
 
void OnReceived (TrafficControlConnectionId id, DataGramControlData &info) override
 Called when Carrier receives a package.
 
bool IsSend (TrafficControlConnectionId id) override
 Return true if we can send a package. Otherwise false.
 
bool IsSendAck (TrafficControlConnectionId id) override
 Return true if you should send ACK/NACK data at this time.
 
unsigned int GetAvailableWindowSize (TrafficControlConnectionId id) const override
 Return number of bytes we are allowed to send at the moment. The size can/will vary over time.
 
bool IsResend (TrafficControlConnectionId id, const DataGramControlData &info, unsigned int resendDataSize) override
 
TimeStamp GetResendTime (TrafficControlConnectionId id, const DataGramControlData &info) override
 
bool IsDisconnect (TrafficControlConnectionId id, float conditionThreshold) override
 Verify traffic conditions and disconnect if needed. This usually happens when we have bad conditions. Too much latency or high packet loss.
 
bool IsCanReceiveData (TrafficControlConnectionId id) const override
 Verify we are able to receive data from a given address.
 
bool IsSendACKOnly (TrafficControlConnectionId id) const override
 
bool Update () override
 Update/Tick returns true if we have updated the statistics (which we can read by QueryStatistics)
 
void QueryStatistics (TrafficControlConnectionId id, Statistics *lastSecond=nullptr, Statistics *lifetime=nullptr, Statistics *effectiveLastSecond=nullptr, Statistics *effectiveLifetime=nullptr) const override
 
void QueryCongestionState (TrafficControlConnectionId id, CongestionState *congestionState) const override
 

Additional Inherited Members

- Public Types inherited from GridMate::TrafficControl
typedef TrafficControlConnectionTrafficControlConnectionId
 Carrier thread connection identifier.
 

Detailed Description

Traffic control default implementation.

Member Function Documentation

◆ GetResendTime()

TimeStamp GridMate::DefaultTrafficControl::GetResendTime ( TrafficControlConnectionId  id,
const DataGramControlData info 
)
overridevirtual

Returns the timestamp for retransmission

Implements GridMate::TrafficControl.

◆ IsResend()

bool GridMate::DefaultTrafficControl::IsResend ( TrafficControlConnectionId  id,
const DataGramControlData info,
unsigned int  resendDataSize 
)
overridevirtual

Called for every package waiting for Ack. If this function returns true the packet will be considered lost. You should resend it and call OnReSend function ASAP.

Implements GridMate::TrafficControl.

◆ IsSendACKOnly()

bool GridMate::DefaultTrafficControl::IsSendACKOnly ( TrafficControlConnectionId  id) const
overridevirtual

Returns true if you need to send a ACK only (empty datagram) due to time and/or number of received datagrams. If you already have data to send ACK will be included in the datagram anyway. This function should be checked only if you have no data to send.

Implements GridMate::TrafficControl.

◆ QueryCongestionState()

void GridMate::DefaultTrafficControl::QueryCongestionState ( TrafficControlConnectionId  id,
CongestionState congestionState 
) const
overridevirtual

Stores current congestion state into the provided block.

Implements GridMate::TrafficControl.

◆ QueryStatistics()

void GridMate::DefaultTrafficControl::QueryStatistics ( TrafficControlConnectionId  id,
Statistics lastSecond = nullptr,
Statistics lifetime = nullptr,
Statistics effectiveLastSecond = nullptr,
Statistics effectiveLifetime = nullptr 
) const
overridevirtual

Stores connection statistics, it's ok to pass NULL for any of the statistics.

Parameters
idConnection ID
lastSecondlast second statistics for all data
lifetimelifetime statistics for all data
effectiveLastSecondlast second statistics for effective data (actual data - carrier overhead excluded)
effectiveLifetimelifetime statistics for effective data (actual data - carrier overhead excluded)

Implements GridMate::TrafficControl.


The documentation for this class was generated from the following file: