Preserve peer locality across schema transports

This commit is contained in:
Meta Vens 2026-07-19 18:50:22 +01:00
commit 6beca4a80a
6 changed files with 50 additions and 5 deletions

View file

@ -189,20 +189,23 @@ namespace GameCult.Networking
}
}
private sealed class TcpPeer : ICultNetSchemaServerPeer, IDisposable
private sealed class TcpPeer : ICultNetSchemaServerPeer, ICultNetSchemaServerPeerLocation, IDisposable
{
private readonly TcpClient _client;
private readonly object _sendGate = new();
private readonly EndPoint? _remoteEndPoint;
public TcpPeer(TcpClient client)
{
_client = client;
_remoteEndPoint = client.Client.RemoteEndPoint;
Transport = new TcpFramedTransportConnection(
client.GetStream(),
CultNetTransportProfiles.CreateTcpFramed("csharp-tcp-schema-server"));
}
public bool Connected => _client.Connected;
public EndPoint? RemoteEndPoint => _remoteEndPoint;
public TcpFramedTransportConnection Transport { get; }
public void SendCultNet<TMessage>(TMessage message) where TMessage : ICultNetSchemaMessage