From 757d50d1dd293c8082d76114393a49e39735529c Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Sat, 24 May 2025 23:28:32 +0300 Subject: [PATCH] Useless ping pong in recovery removed --- mROA/Implementation/Attributes/UntrustedAttribute.cs | 5 +++++ mROA/Implementation/ChannelInteractionModule.cs | 12 ++++-------- mROA/mROA.csproj | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/mROA/Implementation/Attributes/UntrustedAttribute.cs b/mROA/Implementation/Attributes/UntrustedAttribute.cs index 2441590..244c908 100644 --- a/mROA/Implementation/Attributes/UntrustedAttribute.cs +++ b/mROA/Implementation/Attributes/UntrustedAttribute.cs @@ -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; + } } } \ No newline at end of file diff --git a/mROA/Implementation/ChannelInteractionModule.cs b/mROA/Implementation/ChannelInteractionModule.cs index fcec7bd..c99284d 100644 --- a/mROA/Implementation/ChannelInteractionModule.cs +++ b/mROA/Implementation/ChannelInteractionModule.cs @@ -28,10 +28,10 @@ namespace mROA.Implementation SingleWriter = false, }); _receiveReader = ReceiveChanel.Reader; - _outputTrustedChannel = Channel.CreateBounded(new BoundedChannelOptions(1) + _outputTrustedChannel = Channel.CreateUnbounded(new UnboundedChannelOptions { SingleReader = true, - SingleWriter = true, + SingleWriter = true }); _trustedWriter = _outputTrustedChannel.Writer; _outputUntrustedChannel = Channel.CreateUnbounded(new UnboundedChannelOptions @@ -49,7 +49,7 @@ namespace mROA.Implementation public ChannelReader TrustedPostChanel => _outputTrustedChannel.Reader; public ChannelReader UntrustedPostChanel => _outputUntrustedChannel.Reader; - public Func IsConnected { get; set; } = () => false; + public Func IsConnected { get; set; } = () => false; public void Inject(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(); diff --git a/mROA/mROA.csproj b/mROA/mROA.csproj index 6c53c78..c5291f0 100644 --- a/mROA/mROA.csproj +++ b/mROA/mROA.csproj @@ -4,7 +4,7 @@ netstandard2.1 enable mROA - 2.0.1 + 2.0.2 YaslePoy Fast and easy RPC with contex https://github.com/YaslePoy/mROA @@ -25,8 +25,8 @@ - - + +