fix: Fixes network issue with incoming packet length (#1643)
This commit is contained in:
parent
61e9dd29ac
commit
1e73802d1e
1 changed files with 5 additions and 4 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue