Skip to content

Commit

Permalink
fix(AckSystem): fixing fragmented message having incorrect order
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Frowen committed Sep 21, 2022
1 parent 9d4ab86 commit 1fb4970
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Assets/Mirage/Runtime/SocketLayer/AckSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,20 @@ public void SendReliable(byte[] message, int offset, int length)

if (length + MIN_RELIABLE_HEADER_SIZE > _maxPacketSize)
{
if (_allowFragmented)
{
SendFragmented(message, offset, length);
return;
}
else
{
if (!_allowFragmented)
throw new ArgumentException($"Message is bigger than MTU and fragmentation is disabled, max Reliable message size is {_maxPacketSize - MIN_RELIABLE_HEADER_SIZE}", nameof(length));

// if there is existing batch, send it first
// we need to do this so that fragmented message arrive in order
// if we dont, a message sent after maybe be added to batch and then have earlier order than fragmented message
if (_nextBatch != null)
{
SendReliablePacket(_nextBatch);
_nextBatch = null;
}

SendFragmented(message, offset, length);
return;
}


Expand Down

0 comments on commit 1fb4970

Please sign in to comment.