Skip to content

Commit

Permalink
version 3.0.0-dev.12 : return of valueTask from a cancelled token
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya committed Dec 18, 2024
1 parent f9079c4 commit 0200151
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ private async void WriteLoop(object? o)

public override ValueTask Send(IProtocolMessage message, CancellationToken cancel = default)
{
if (cancel.IsCancellationRequested) return ValueTask.FromCanceled(cancel);
if (IsDisposed) return ValueTask.CompletedTask;
if (_lastError.CurrentValue != null) return ValueTask.CompletedTask;
return _txChannel.Writer.WriteAsync(message, cancel);
Expand Down
1 change: 1 addition & 0 deletions src/Asv.IO/Protocol/Connection/Port/ProtocolPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ private void ReconnectAfterError(object? state)
public override async ValueTask Send(IProtocolMessage message, CancellationToken cancel = default)
{
if (IsDisposed) return;
cancel.ThrowIfCancellationRequested();
var newMessage = await InternalFilterTxMessage(message);
if (newMessage == null) return;
var endpoints = _endpoints;
Expand Down
1 change: 1 addition & 0 deletions src/Asv.IO/Protocol/Connection/Virtual/VirtualPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void SetTxFilter(Func<IProtocolMessage, bool> filter)

public override ValueTask Send(IProtocolMessage message, CancellationToken cancel = default)
{
if (cancel.IsCancellationRequested) return ValueTask.FromCanceled(cancel);
if (IsDisposed) return ValueTask.CompletedTask;
if (_sendFilter(message) == false) return ValueTask.CompletedTask;
try
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<ProductVersion>3.0.0-dev.11</ProductVersion>
<ProductVersion>3.0.0-dev.12</ProductVersion>
<ProductPrevVersion>3.0.0</ProductPrevVersion>
<R3Version>1.2.9</R3Version>
<NewtonsoftJsonVersion>13.0.3</NewtonsoftJsonVersion>
Expand Down

0 comments on commit 0200151

Please sign in to comment.