Cancel + specify add family
MODIFY
WalletWasabi/Tor/Control/TorControlClientFactory.cs
WalletWasabi/Tor/Control/TorControlClientFactory.cs
@@ -42,7 +42,7 @@ public class TorControlClientFactory
TcpClient tcpClient;
try
{
- tcpClient = await TcpClientConnector.ConnectAsync(endPoint).ConfigureAwait(false);
+ tcpClient = await TcpClientConnector.ConnectAsync(endPoint, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{

MODIFY
WalletWasabi/Tor/TcpClientConnector.cs
WalletWasabi/Tor/TcpClientConnector.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
namespace WalletWasabi.Tor;
@@ -13,17 +14,17 @@ public static class TcpClientConnector
/// <summary>
/// Connects to end point using a TCP client.
/// </summary>
- public static async Task<TcpClient> ConnectAsync(EndPoint endPoint)
+ public static async Task<TcpClient> ConnectAsync(EndPoint endPoint, CancellationToken cancel)
{
- TcpClient tcpClient = new();
+ TcpClient tcpClient = new(endPoint.AddressFamily);
switch (endPoint)
{
case DnsEndPoint dnsEndPoint:
- await tcpClient.ConnectAsync(dnsEndPoint.Host, dnsEndPoint.Port).ConfigureAwait(false);
+ await tcpClient.ConnectAsync(dnsEndPoint.Host, dnsEndPoint.Port, cancel).ConfigureAwait(false);
break;
case IPEndPoint ipEndPoint:
- await tcpClient.ConnectAsync(ipEndPoint).ConfigureAwait(false);
+ await tcpClient.ConnectAsync(ipEndPoint, cancel).ConfigureAwait(false);
break;
default:

Cancel + specify add family