[saco] Match ReliabilityLayer::CreateInternalPacketFromBitStream(...)

This commit is contained in:
RD42
2025-04-30 03:41:20 -07:00
parent 7ca5c0ca56
commit dc1ce335c8
3 changed files with 10 additions and 8 deletions

View File

@ -33,12 +33,12 @@
#ifdef _COMPATIBILITY_1
#define DEFAULT_MTU_SIZE 1264
#else
#define DEFAULT_MTU_SIZE 1500
#define DEFAULT_MTU_SIZE 576
#endif
/// The largest value for an UDP datagram
/// \sa RakPeer::SetMTUSize()
#define MAXIMUM_MTU_SIZE 1500
#define MAXIMUM_MTU_SIZE 1492
#endif

View File

@ -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
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.
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.

View File

@ -1783,7 +1783,7 @@ InternalPacket* ReliabilityLayer::CreateInternalPacketFromBitStream( RakNet::Bit
// Read the PacketReliability. This is encoded in 3 bits
unsigned char reliability;
bitStreamSucceeded = bitStream->ReadBits( ( unsigned char* ) ( &( reliability ) ), 3 );
bitStreamSucceeded = bitStream->ReadBits( ( unsigned char* ) ( &( reliability ) ), reliabilitySizeInBits );
internalPacket->reliability = ( const PacketReliability ) reliability;
@ -1792,7 +1792,7 @@ InternalPacket* ReliabilityLayer::CreateInternalPacketFromBitStream( RakNet::Bit
// assert( bitStreamSucceeded );
#endif
if ( bitStreamSucceeded == false )
if ( reliability < UNRELIABLE || bitStreamSucceeded == false )
{
internalPacketPool.ReleasePointer( internalPacket );
return 0;
@ -1829,7 +1829,7 @@ InternalPacket* ReliabilityLayer::CreateInternalPacketFromBitStream( RakNet::Bit
}
// Read if this is a split packet (1 bit)
bool isSplitPacket;
bool isSplitPacket = false;
bitStreamSucceeded = bitStream->Read( isSplitPacket );
@ -1882,9 +1882,11 @@ InternalPacket* ReliabilityLayer::CreateInternalPacketFromBitStream( RakNet::Bit
return 0;
}
}
else
internalPacket->splitPacketIndex = internalPacket->splitPacketCount = 0;
{
internalPacket->splitPacketIndex = 0;
internalPacket->splitPacketCount = 0;
}
// Optimization - do byte alignment here
//unsigned char zero;