mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-09-19 20:26:14 +08:00
[raknet] Implement ReliabilityLayer::SetPing(...)
This commit is contained in:
@ -15,6 +15,28 @@ ReliabilityLayer::ReliabilityLayer()
|
|||||||
void ReliabilityLayer::InitializeVariables( void )
|
void ReliabilityLayer::InitializeVariables( void )
|
||||||
{
|
{
|
||||||
// TODO: ReliabilityLayer::InitializeVariables
|
// TODO: ReliabilityLayer::InitializeVariables
|
||||||
|
|
||||||
|
SetPing( 1000 );
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------
|
||||||
|
// How long to wait between packet resends
|
||||||
|
//-------------------------------------------------------------------------------------------------------
|
||||||
|
void ReliabilityLayer::SetPing( RakNetTime i )
|
||||||
|
{
|
||||||
|
//assert(i < (RakNetTimeNS)timeoutTime*1000);
|
||||||
|
if (i > timeoutTime)
|
||||||
|
ping=500;
|
||||||
|
else
|
||||||
|
ping = i;
|
||||||
|
if (ping < 30)
|
||||||
|
ping=30; // Leave a buffer for variations in ping
|
||||||
|
#ifndef _RELEASE
|
||||||
|
if (ping < (RakNetTime)(minExtraPing+extraPingVariance)*2)
|
||||||
|
ping=(minExtraPing+extraPingVariance)*2;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UpdateNextActionTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------
|
||||||
|
@ -13,6 +13,10 @@ public:
|
|||||||
/// Constructor
|
/// Constructor
|
||||||
ReliabilityLayer();
|
ReliabilityLayer();
|
||||||
|
|
||||||
|
/// Sets the ping, which is used by the reliability layer to determine how long to wait for resends. Mostly for flow control.
|
||||||
|
/// \param[in] The ping time.
|
||||||
|
void SetPing( RakNetTime i );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Initialize the variables
|
// Initialize the variables
|
||||||
@ -25,9 +29,19 @@ private:
|
|||||||
|
|
||||||
RakNetTime ping;
|
RakNetTime ping;
|
||||||
|
|
||||||
char _gap[1020];
|
char _gap2D1[2];
|
||||||
|
|
||||||
|
RakNetTime timeoutTime; // How long to wait in MS before timing someone out
|
||||||
|
|
||||||
|
char _gap2D7[1014];
|
||||||
|
|
||||||
RakNetTimeNS ackTimeIncrement;
|
RakNetTimeNS ackTimeIncrement;
|
||||||
|
|
||||||
|
char _gap6D1[25];
|
||||||
|
|
||||||
|
// Internet simulator
|
||||||
|
RakNetTime minExtraPing, extraPingVariance;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user