Skip to content

Commit

Permalink
Merge pull request #186 from sherief/packet-size-fix
Browse files Browse the repository at this point in the history
Fixes #185 (Large messages can clog ReliableOrderedChannel indefinitely).
  • Loading branch information
gafferongames authored Dec 24, 2023
2 parents fcad339 + 1988f27 commit 3aebe70
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions yojimbo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,7 @@ namespace yojimbo
uint16_t previousMessageId = 0;
int usedBits = ConservativeMessageHeaderBits;
int giveUpCounter = 0;
const int maxBits = availableBits;

for ( int i = 0; i < messageLimit; ++i )
{
Expand All @@ -1494,12 +1495,10 @@ namespace yojimbo

if ( entry->block )
break;

if ( numMessageIds == 0 ) {
// Increase your ClientServerConfig's maxPacketSize and maxPacketFragments, or send smaller messages!
yojimbo_assert( entry->measuredBits <= availableBits );
}


// Increase your max packet size!
yojimbo_assert( entry->measuredBits <= maxBits );

if ( entry->timeLastSent + m_config.messageResendTime <= m_time && availableBits >= (int) entry->measuredBits )
{
int messageBits = entry->measuredBits + messageTypeBits;
Expand Down

0 comments on commit 3aebe70

Please sign in to comment.