fix: Fixes network issue with incoming packet length (#1643)

This commit is contained in:
Kamron Batman 2023-12-20 13:19:00 -08:00 committed by GitHub
parent 61e9dd29ac
commit 1e73802d1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -844,16 +844,17 @@ public partial class NetState : IComparable<NetState>, IValueLinkListNode<NetSta
UpdatePacketCount(packetId);
var packetBuffer = packetReader.Buffer[..packetLength];
if (PacketLogging)
{
LogPacket(packetBuffer, true);
LogPacket(packetReader.Buffer[..packetLength], true);
}
// Make a new SpanReader that is limited to the length of the packet.
// This allows us to use reader.Remaining for VendorBuyReply packet
handler.OnReceive(this, new SpanReader(packetBuffer));
var start = packetReader.Position;
var remainingLength = packetLength - packetReader.Position;
handler.OnReceive(this, new SpanReader(packetReader.Buffer.Slice(start, remainingLength)));
prof?.Finish(packetLength);