[raknet] Match ReliabilityLayer::GetStatistics(...)

* Update `RakPeer::GetStatistics(...)`
* Update `RakPeer::RunUpdateCycle()`
This commit is contained in:
RD42
2025-05-05 12:06:10 -07:00
parent 6030d3be0a
commit 786f6c4e10
3 changed files with 10 additions and 6 deletions

View File

@ -2348,7 +2348,7 @@ RakNetStatisticsStruct * const RakPeer::GetStatistics( const PlayerID playerId )
{ {
if (remoteSystemList[ i ].isActive) if (remoteSystemList[ i ].isActive)
{ {
systemStats=remoteSystemList[ i ].reliabilityLayer.GetStatistics(); systemStats=remoteSystemList[ i ].reliabilityLayer.GetStatistics( true );
if (firstWrite==true) if (firstWrite==true)
{ {
@ -2366,7 +2366,7 @@ RakNetStatisticsStruct * const RakPeer::GetStatistics( const PlayerID playerId )
RemoteSystemStruct * rss; RemoteSystemStruct * rss;
rss = GetRemoteSystemFromPlayerID( playerId, false, false ); rss = GetRemoteSystemFromPlayerID( playerId, false, false );
if ( rss && endThreads==false ) if ( rss && endThreads==false )
return rss->reliabilityLayer.GetStatistics(); return rss->reliabilityLayer.GetStatistics( true );
} }
return 0; return 0;
@ -4148,7 +4148,7 @@ bool RakPeer::RunUpdateCycle( void )
if (timeMS > remoteSystem->lastReliableSend && timeMS-remoteSystem->lastReliableSend > 5000 && remoteSystem->connectMode==RemoteSystemStruct::CONNECTED) if (timeMS > remoteSystem->lastReliableSend && timeMS-remoteSystem->lastReliableSend > 5000 && remoteSystem->connectMode==RemoteSystemStruct::CONNECTED)
{ {
// If no reliable packets are waiting for an ack, do a one byte reliable send so that disconnections are noticed // If no reliable packets are waiting for an ack, do a one byte reliable send so that disconnections are noticed
rnss=remoteSystem->reliabilityLayer.GetStatistics(); rnss=remoteSystem->reliabilityLayer.GetStatistics( false );
if (rnss->messagesOnResendQueue==0) if (rnss->messagesOnResendQueue==0)
{ {
unsigned char keepAlive=ID_DETECT_LOST_CONNECTIONS; unsigned char keepAlive=ID_DETECT_LOST_CONNECTIONS;

View File

@ -2476,7 +2476,7 @@ void ReliabilityLayer::UpdateNextActionTime(void)
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
// Statistics // Statistics
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
RakNetStatisticsStruct * const ReliabilityLayer::GetStatistics( void ) RakNetStatisticsStruct * const ReliabilityLayer::GetStatistics( bool includeResendListDataSize )
{ {
unsigned i; unsigned i;
@ -2494,7 +2494,11 @@ RakNetStatisticsStruct * const ReliabilityLayer::GetStatistics( void )
statistics.bitsPerSecond = currentBandwidth; statistics.bitsPerSecond = currentBandwidth;
//statistics.lossySize = lossyWindowSize == MAXIMUM_WINDOW_SIZE + 1 ? 0 : lossyWindowSize; //statistics.lossySize = lossyWindowSize == MAXIMUM_WINDOW_SIZE + 1 ? 0 : lossyWindowSize;
// statistics.lossySize=0; // statistics.lossySize=0;
statistics.messagesOnResendQueue = GetResendListDataSize(); if (!includeResendListDataSize)
statistics.messagesOnResendQueue = GetResendListDataSize();
else
statistics.messagesOnResendQueue = 0;
return &statistics; return &statistics;
} }

View File

@ -151,7 +151,7 @@ public:
/// Get Statistics /// Get Statistics
/// \return A pointer to a static struct, filled out with current statistical information. /// \return A pointer to a static struct, filled out with current statistical information.
RakNetStatisticsStruct * const GetStatistics( void ); RakNetStatisticsStruct * const GetStatistics( bool includeResendListDataSize );
///Are we waiting for any data to be sent out or be processed by the player? ///Are we waiting for any data to be sent out or be processed by the player?
bool IsDataWaiting(void); bool IsDataWaiting(void);