LocalConnectionToClient: update comments

This commit is contained in:
mischa 2023-11-16 17:10:49 +01:00
parent d6c43a343b
commit 8ec937dfa6

View File

@ -12,14 +12,12 @@ public LocalConnectionToClient() : base(LocalConnectionId) {}
public override string address => "localhost"; public override string address => "localhost";
// Send stage two: serialized NetworkMessage as ArraySegment<byte>
internal override void Send(ArraySegment<byte> segment, int channelId = Channels.Reliable) internal override void Send(ArraySegment<byte> segment, int channelId = Channels.Reliable)
{ {
// get a writer to copy the message into since the segment is only // instead of invoking it directly, we enqueue and process next update.
// valid until returning. // this way we can simulate a similar call flow as with remote clients.
// => pooled writer will be returned to pool when dequeuing. // the closer we get to simulating host as remote, the better!
// => WriteBytes instead of WriteArraySegment because the latter
// includes a 4 bytes header. we just want to write raw.
//Debug.Log($"Enqueue {BitConverter.ToString(segment.Array, segment.Offset, segment.Count)}"); //Debug.Log($"Enqueue {BitConverter.ToString(segment.Array, segment.Offset, segment.Count)}");
NetworkWriterPooled writer = NetworkWriterPool.Get(); NetworkWriterPooled writer = NetworkWriterPool.Get();
writer.WriteBytes(segment.Array, segment.Offset, segment.Count); writer.WriteBytes(segment.Array, segment.Offset, segment.Count);