mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-01-04 00:23:22 +08:00
[raknet] Implement RakPeer::SetMTUSize(...)
This commit is contained in:
parent
98dc42b0d7
commit
ad8c70ee50
@ -36,5 +36,13 @@
|
|||||||
#define DEFAULT_MTU_SIZE 576
|
#define DEFAULT_MTU_SIZE 576
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// The largest value for an UDP datagram
|
||||||
|
/// \sa RakPeer::SetMTUSize()
|
||||||
|
#ifdef SAMPCLI
|
||||||
|
#define MAXIMUM_MTU_SIZE 1492
|
||||||
|
#else
|
||||||
|
#define MAXIMUM_MTU_SIZE 576
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -346,9 +346,41 @@ void RakPeer::vftable_A4()
|
|||||||
// TODO: RakPeer::vftable_A4() (saco W: 1003E520) (server W: 455810 L: 806DC70) (bot W: 4094C0 L: 8075056)
|
// TODO: RakPeer::vftable_A4() (saco W: 1003E520) (server W: 455810 L: 806DC70) (bot W: 4094C0 L: 8075056)
|
||||||
}
|
}
|
||||||
|
|
||||||
void RakPeer::vftable_A8()
|
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Description:
|
||||||
|
// Change the MTU size in order to improve performance when sending large packets
|
||||||
|
// This can only be called when not connected.
|
||||||
|
// A too high of value will cause packets not to arrive at worst and be fragmented at best.
|
||||||
|
// A too low of value will split packets unnecessarily.
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
// size: Set according to the following table:
|
||||||
|
// 1500. The largest Ethernet packet size
|
||||||
|
// This is the typical setting for non-PPPoE, non-VPN connections. The default value for NETGEAR routers, adapters and switches.
|
||||||
|
// 1492. The size PPPoE prefers.
|
||||||
|
// 1472. Maximum size to use for pinging. (Bigger packets are fragmented.)
|
||||||
|
// 1468. The size DHCP prefers.
|
||||||
|
// 1460. Usable by AOL if you don't have large email attachments, etc.
|
||||||
|
// 1430. The size VPN and PPTP prefer.
|
||||||
|
// 1400. Maximum size for AOL DSL.
|
||||||
|
// 576. Typical value to connect to dial-up ISPs. (Default)
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// False on failure (we are connected). True on success. Maximum allowed size is MAXIMUM_MTU_SIZE
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool RakPeer::SetMTUSize( int size )
|
||||||
{
|
{
|
||||||
// TODO: RakPeer::vftable_A8() (saco W: 10038860) (server W: 450360 L: 8070050) (bot W: 4042A0 L: 807514E)
|
if ( IsActive() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( size < 512 )
|
||||||
|
size = 512;
|
||||||
|
else if ( size > MAXIMUM_MTU_SIZE )
|
||||||
|
size = MAXIMUM_MTU_SIZE;
|
||||||
|
|
||||||
|
MTUSize = size;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -122,7 +122,16 @@ public:
|
|||||||
|
|
||||||
void vftable_A0();
|
void vftable_A0();
|
||||||
void vftable_A4();
|
void vftable_A4();
|
||||||
void vftable_A8();
|
|
||||||
|
/// Set the MTU per datagram. It's important to set this correctly - otherwise packets will be needlessly split, decreasing performance and throughput.
|
||||||
|
/// Maximum allowed size is MAXIMUM_MTU_SIZE.
|
||||||
|
/// Too high of a value will cause packets not to arrive at worst and be fragmented at best.
|
||||||
|
/// Too low of a value will split packets unnecessarily.
|
||||||
|
/// Recommended size is 1500
|
||||||
|
/// sa MTUSize.h
|
||||||
|
/// \pre Can only be called when not connected.
|
||||||
|
/// \return false on failure (we are connected), else true
|
||||||
|
bool SetMTUSize( int size );
|
||||||
|
|
||||||
/// Returns the current MTU size
|
/// Returns the current MTU size
|
||||||
/// \return The current MTU size
|
/// \return The current MTU size
|
||||||
|
@ -118,7 +118,16 @@ public:
|
|||||||
|
|
||||||
virtual void vftable_A0()=0;
|
virtual void vftable_A0()=0;
|
||||||
virtual void vftable_A4()=0;
|
virtual void vftable_A4()=0;
|
||||||
virtual void vftable_A8()=0;
|
|
||||||
|
/// Set the MTU per datagram. It's important to set this correctly - otherwise packets will be needlessly split, decreasing performance and throughput.
|
||||||
|
/// Maximum allowed size is MAXIMUM_MTU_SIZE.
|
||||||
|
/// Too high of a value will cause packets not to arrive at worst and be fragmented at best.
|
||||||
|
/// Too low of a value will split packets unnecessarily.
|
||||||
|
/// Recommended size is 1500
|
||||||
|
/// sa MTUSize.h
|
||||||
|
/// \pre Can only be called when not connected.
|
||||||
|
/// \return false on failure (we are connected), else true
|
||||||
|
virtual bool SetMTUSize( int size )=0;
|
||||||
|
|
||||||
/// Returns the current MTU size
|
/// Returns the current MTU size
|
||||||
/// \return The current MTU size
|
/// \return The current MTU size
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="d3d9\include\"
|
AdditionalIncludeDirectories="d3d9\include\"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SACO_EXPORTS"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SACO_EXPORTS;SAMPCLI"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@ -72,7 +72,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="d3d9\include\"
|
AdditionalIncludeDirectories="d3d9\include\"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SACO_EXPORTS"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SACO_EXPORTS;SAMPCLI"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
StructMemberAlignment="1"
|
StructMemberAlignment="1"
|
||||||
BufferSecurityCheck="FALSE"
|
BufferSecurityCheck="FALSE"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user