mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-09-19 20:26:14 +08:00
[raknet] Implement ReliabilityLayer::UpdateNextActionTime()
This commit is contained in:
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
#include "ReliabilityLayer.h"
|
#include "ReliabilityLayer.h"
|
||||||
|
|
||||||
|
static const float PING_MULTIPLIER_TO_RESEND=3.0; // So internet ping variation doesn't cause needless resends
|
||||||
|
static const RakNetTime MIN_PING_TO_RESEND=30; // So system timer changes and CPU lag don't send needless resends
|
||||||
|
|
||||||
ReliabilityLayer::ReliabilityLayer()
|
ReliabilityLayer::ReliabilityLayer()
|
||||||
{
|
{
|
||||||
// TODO: ReliabilityLayer::ReliabilityLayer
|
// TODO: ReliabilityLayer::ReliabilityLayer
|
||||||
@ -13,3 +16,13 @@ void ReliabilityLayer::InitializeVariables( void )
|
|||||||
{
|
{
|
||||||
// TODO: ReliabilityLayer::InitializeVariables
|
// TODO: ReliabilityLayer::InitializeVariables
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------
|
||||||
|
void ReliabilityLayer::UpdateNextActionTime(void)
|
||||||
|
{
|
||||||
|
//double multiple = log10(currentBandwidth/MINIMUM_SEND_BPS) / 0.30102999566398119521373889472449;
|
||||||
|
if (ping*(RakNetTime)PING_MULTIPLIER_TO_RESEND < MIN_PING_TO_RESEND)
|
||||||
|
ackTimeIncrement=(RakNetTimeNS)MIN_PING_TO_RESEND*1000;
|
||||||
|
else
|
||||||
|
ackTimeIncrement=(RakNetTimeNS)(ping*(RakNetTime)PING_MULTIPLIER_TO_RESEND)*1000;
|
||||||
|
}
|
||||||
|
@ -13,9 +13,21 @@ public:
|
|||||||
/// Constructor
|
/// Constructor
|
||||||
ReliabilityLayer();
|
ReliabilityLayer();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
// Initialize the variables
|
// Initialize the variables
|
||||||
void InitializeVariables( void );
|
void InitializeVariables( void );
|
||||||
|
|
||||||
|
// Make it so we don't do resends within a minimum threshold of time
|
||||||
|
void UpdateNextActionTime(void);
|
||||||
|
|
||||||
|
char _gap0[713];
|
||||||
|
|
||||||
|
RakNetTime ping;
|
||||||
|
|
||||||
|
char _gap[1020];
|
||||||
|
|
||||||
|
RakNetTimeNS ackTimeIncrement;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user