Useless ping pong in recovery removed

This commit is contained in:
2025-05-24 23:28:32 +03:00
parent 5a4d889e0c
commit 757d50d1dd
3 changed files with 12 additions and 11 deletions
@@ -4,5 +4,10 @@ namespace mROA.Implementation.Attributes
{
public class UntrustedAttribute : Attribute
{
public bool UseAwait { get; private set; }
public UntrustedAttribute(bool useAwait = true)
{
UseAwait = useAwait;
}
}
}
@@ -28,10 +28,10 @@ namespace mROA.Implementation
SingleWriter = false,
});
_receiveReader = ReceiveChanel.Reader;
_outputTrustedChannel = Channel.CreateBounded<NetworkMessageHeader>(new BoundedChannelOptions(1)
_outputTrustedChannel = Channel.CreateUnbounded<NetworkMessageHeader>(new UnboundedChannelOptions
{
SingleReader = true,
SingleWriter = true,
SingleWriter = true
});
_trustedWriter = _outputTrustedChannel.Writer;
_outputUntrustedChannel = Channel.CreateUnbounded<NetworkMessageHeader>(new UnboundedChannelOptions
@@ -49,7 +49,7 @@ namespace mROA.Implementation
public ChannelReader<NetworkMessageHeader> TrustedPostChanel => _outputTrustedChannel.Reader;
public ChannelReader<NetworkMessageHeader> UntrustedPostChanel => _outputUntrustedChannel.Reader;
public Func<bool> IsConnected { get; set; } = () => false;
public Func<bool> IsConnected { get; set; } = () => false;
public void Inject<T>(T dependency)
{
@@ -121,13 +121,9 @@ namespace mROA.Implementation
{
await PostMessageAsync(
new NetworkMessageHeader(_serialization!, new ClientRecovery(Math.Abs(ConnectionId)), _context));
await ReceiveChanel.Reader.ReadAsync();
}
else
{
await _trustedWriter.WriteAsync(new NetworkMessageHeader());
}
_reconnection.TrySetResult(Stream.Null);
_isConnected = true;
_reconnection = new TaskCompletionSource<Stream>();