Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth committed Nov 20, 2023
1 parent 98bdfa7 commit ad42067
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Robust.Shared/Network/Messages/MsgState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer
}

serializer.DeserializeDirect(finalStream, out State);

// This is just a sanity check the the pool isn't leaking.
#if DEBUG
Array.Clear(finalStream.GetBuffer());
#endif

State.PayloadSize = uncompressedLength;
}

Expand Down Expand Up @@ -83,10 +89,14 @@ public override void WriteToBuffer(NetOutgoingMessage buffer, IRobustSerializer
{
// 0 means that the state isn't compressed.
buffer.WriteVariableInt32(0);

buffer.Write(stateStream.AsSpan());
}

// This is just a sanity check the the pool isn't leaking.
#if DEBUG
Array.Clear(stateStream.GetBuffer());
#endif

_hasWritten = true;
MsgSize = buffer.LengthBytes;
}
Expand Down

0 comments on commit ad42067

Please sign in to comment.