`AcceptTcpClientAsync` accepts cancellation token in .NET 6
MODIFY
WalletWasabi.Tests/UnitTests/Tor/Socks5/TorTcpConnectionFactoryTests.cs
WalletWasabi.Tests/UnitTests/Tor/Socks5/TorTcpConnectionFactoryTests.cs
@@ -51,7 +51,7 @@ namespace WalletWasabi.Tests.UnitTests.Tor.Socks5
int serverPort = ((IPEndPoint)listener.LocalEndpoint).Port;
Logger.LogTrace($"[{nameof(AuthenticationErrorScenarioAsync)}][server] Waiting for a TCP client on port {serverPort}.");
- Task<TcpClient> acceptTask = listener.AcceptTcpClientAsync().WithAwaitCancellationAsync(timeoutToken);
+ ValueTask<TcpClient> acceptTask = listener.AcceptTcpClientAsync(timeoutToken);
Task clientTask = Task.Run(
async () =>
@@ -124,7 +124,7 @@ namespace WalletWasabi.Tests.UnitTests.Tor.Socks5
int serverPort = ((IPEndPoint)listener.LocalEndpoint).Port;
Logger.LogTrace($"[{nameof(TtlExpiredScenarioAsync)}][server] Wait for TCP client on port {serverPort}.");
- Task<TcpClient> acceptTask = listener.AcceptTcpClientAsync().WithAwaitCancellationAsync(timeoutToken);
+ ValueTask<TcpClient> acceptTask = listener.AcceptTcpClientAsync(timeoutToken);
Task clientTask = Task.Run(
async () =>

MODIFY
WalletWasabi/Services/SingleInstanceChecker.cs
WalletWasabi/Services/SingleInstanceChecker.cs
@@ -138,7 +138,7 @@ namespace WalletWasabi.Services
while (!stoppingToken.IsCancellationRequested)
{
// In case of cancellation, listener.Stop will cause AcceptTcpClientAsync to throw, thus canceling it.
- using var client = await listener.AcceptTcpClientAsync().WithAwaitCancellationAsync(stoppingToken).ConfigureAwait(false);
+ using var client = await listener.AcceptTcpClientAsync(stoppingToken).ConfigureAwait(false);
client.ReceiveBufferSize = 1000;
try
{

`AcceptTcpClientAsync` accepts cancellation token in .NET 6