Fixing invalid display of TorRunning on non English OP system when TOR client not running
MODIFY
WalletWasabi/TorSocks5/TorSocks5Client.cs
WalletWasabi/TorSocks5/TorSocks5Client.cs
@@ -88,16 +88,26 @@ namespace WalletWasabi.TorSocks5
using (await AsyncLock.LockAsync())
{
+ Exception error = null;
try
{
await TcpClient.ConnectAsync(TorSocks5EndPoint.Address, TorSocks5EndPoint.Port);
}
// ex.Message must be checked, because I'm having difficulty catching SocketExceptionFactory+ExtendedSocketException
- catch (Exception ex) when (ex.Message.StartsWith("No connection could be made because the target machine actively refused it")
+ catch (Exception ex) when (ex.Message.StartsWith(
+ "No connection could be made because the target machine actively refused it")
|| ex.Message.StartsWith("Connection refused"))
{
- throw new ConnectionException($"Couldn't connect to Tor SOCKSPort at {TorSocks5EndPoint.Address}:{TorSocks5EndPoint.Port}. Is Tor running?", ex);
+ error = ex;
}
+ catch (SocketException ex) when(ex.ErrorCode == 10061)
+ {
+ error = ex;
+ }
+ if (error!=null)
+ throw new ConnectionException(
+ $"Couldn't connect to Tor SOCKSPort at {TorSocks5EndPoint.Address}:{TorSocks5EndPoint.Port}. Is Tor running?",error);
+
Stream = TcpClient.GetStream();
RemoteEndPoint = TcpClient.Client.RemoteEndPoint as IPEndPoint;
}

Fixing invalid display of TorRunning on non English OP system when TOR client not running