mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-09-19 04:06:06 +08:00
[saco] Match ReliabilityLayer::CreateInternalPacketFromBitStream(...)
This commit is contained in:
@ -33,12 +33,12 @@
|
|||||||
#ifdef _COMPATIBILITY_1
|
#ifdef _COMPATIBILITY_1
|
||||||
#define DEFAULT_MTU_SIZE 1264
|
#define DEFAULT_MTU_SIZE 1264
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_MTU_SIZE 1500
|
#define DEFAULT_MTU_SIZE 576
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// The largest value for an UDP datagram
|
/// The largest value for an UDP datagram
|
||||||
/// \sa RakPeer::SetMTUSize()
|
/// \sa RakPeer::SetMTUSize()
|
||||||
#define MAXIMUM_MTU_SIZE 1500
|
#define MAXIMUM_MTU_SIZE 1492
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ enum PacketPriority
|
|||||||
/// \note Note to self: I write this with 3 bits in the stream. If I add more remember to change that
|
/// \note Note to self: I write this with 3 bits in the stream. If I add more remember to change that
|
||||||
enum PacketReliability
|
enum PacketReliability
|
||||||
{
|
{
|
||||||
UNRELIABLE, /// Same as regular UDP, except that it will also discard duplicate datagrams. RakNet adds (6 to 17) + 21 bits of overhead, 16 of which is used to detect duplicate packets and 6 to 17 of which is used for message length.
|
UNRELIABLE = 6, /// Same as regular UDP, except that it will also discard duplicate datagrams. RakNet adds (6 to 17) + 21 bits of overhead, 16 of which is used to detect duplicate packets and 6 to 17 of which is used for message length.
|
||||||
UNRELIABLE_SEQUENCED, /// Regular UDP with a sequence counter. Out of order messages will be discarded. This adds an additional 13 bits on top what is used for UNRELIABLE.
|
UNRELIABLE_SEQUENCED, /// Regular UDP with a sequence counter. Out of order messages will be discarded. This adds an additional 13 bits on top what is used for UNRELIABLE.
|
||||||
RELIABLE, /// The message is sent reliably, but not necessarily in any order. Same overhead as UNRELIABLE.
|
RELIABLE, /// The message is sent reliably, but not necessarily in any order. Same overhead as UNRELIABLE.
|
||||||
RELIABLE_ORDERED, /// This message is reliable and will arrive in the order you sent it. Messages will be delayed while waiting for out of order messages. Same overhead as UNRELIABLE_SEQUENCED.
|
RELIABLE_ORDERED, /// This message is reliable and will arrive in the order you sent it. Messages will be delayed while waiting for out of order messages. Same overhead as UNRELIABLE_SEQUENCED.
|
||||||
|
@ -1783,7 +1783,7 @@ InternalPacket* ReliabilityLayer::CreateInternalPacketFromBitStream( RakNet::Bit
|
|||||||
// Read the PacketReliability. This is encoded in 3 bits
|
// Read the PacketReliability. This is encoded in 3 bits
|
||||||
unsigned char reliability;
|
unsigned char reliability;
|
||||||
|
|
||||||
bitStreamSucceeded = bitStream->ReadBits( ( unsigned char* ) ( &( reliability ) ), 3 );
|
bitStreamSucceeded = bitStream->ReadBits( ( unsigned char* ) ( &( reliability ) ), reliabilitySizeInBits );
|
||||||
|
|
||||||
internalPacket->reliability = ( const PacketReliability ) reliability;
|
internalPacket->reliability = ( const PacketReliability ) reliability;
|
||||||
|
|
||||||
@ -1792,7 +1792,7 @@ InternalPacket* ReliabilityLayer::CreateInternalPacketFromBitStream( RakNet::Bit
|
|||||||
// assert( bitStreamSucceeded );
|
// assert( bitStreamSucceeded );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( bitStreamSucceeded == false )
|
if ( reliability < UNRELIABLE || bitStreamSucceeded == false )
|
||||||
{
|
{
|
||||||
internalPacketPool.ReleasePointer( internalPacket );
|
internalPacketPool.ReleasePointer( internalPacket );
|
||||||
return 0;
|
return 0;
|
||||||
@ -1829,7 +1829,7 @@ InternalPacket* ReliabilityLayer::CreateInternalPacketFromBitStream( RakNet::Bit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read if this is a split packet (1 bit)
|
// Read if this is a split packet (1 bit)
|
||||||
bool isSplitPacket;
|
bool isSplitPacket = false;
|
||||||
|
|
||||||
bitStreamSucceeded = bitStream->Read( isSplitPacket );
|
bitStreamSucceeded = bitStream->Read( isSplitPacket );
|
||||||
|
|
||||||
@ -1882,9 +1882,11 @@ InternalPacket* ReliabilityLayer::CreateInternalPacketFromBitStream( RakNet::Bit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
internalPacket->splitPacketIndex = internalPacket->splitPacketCount = 0;
|
{
|
||||||
|
internalPacket->splitPacketIndex = 0;
|
||||||
|
internalPacket->splitPacketCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Optimization - do byte alignment here
|
// Optimization - do byte alignment here
|
||||||
//unsigned char zero;
|
//unsigned char zero;
|
||||||
|
Reference in New Issue
Block a user