Permalink
Browse files

Fix non-English Linux issue.

  • Loading branch information...
nopara73 committed Nov 2, 2018
1 parent e951d65 commit 8bbcee60314f73248ba164658983c18f5c869b39
Showing with 9 additions and 2 deletions.
  1. +9 −2 WalletWasabi/TorSocks5/TorSocks5Client.cs
@@ -94,16 +94,23 @@ internal async Task ConnectAsync()
await TcpClient.ConnectAsync(TorSocks5EndPoint.Address, TorSocks5EndPoint.Port);
}
// ex.Message must be checked, because I'm having difficulty catching SocketExceptionFactory+ExtendedSocketException
// Only works on English Os-es.
catch (Exception ex) when (ex.Message.StartsWith(
"No connection could be made because the target machine actively refused it")
|| ex.Message.StartsWith("Connection refused"))
"No connection could be made because the target machine actively refused it") // Windows
|| ex.Message.StartsWith("Connection refused")) // Linux
{
error = ex;
}
// "No connection could be made because the target machine actively refused it" for non-English Windows.
catch (SocketException ex) when (ex.ErrorCode == 10061)
{
error = ex;
}
// "Connection refused" for non-English Linux.
catch (SocketException ex) when (ex.ErrorCode == 111)
{
error = ex;
}
if (error != null)
throw new ConnectionException(
$"Couldn't connect to Tor SOCKSPort at {TorSocks5EndPoint.Address}:{TorSocks5EndPoint.Port}. Is Tor running?", error);

0 comments on commit 8bbcee6

Please sign in to comment.