Replace a field by a readonly auto-property (getter)
MODIFY
WalletWasabi/Exceptions/TorSocks5FailureResponseException.cs
WalletWasabi/Exceptions/TorSocks5FailureResponseException.cs
@@ -6,11 +6,11 @@ namespace WalletWasabi.Exceptions
{
public class TorSocks5FailureResponseException : Exception
{
- internal RepField _repField;
+ public RepField RepField { get; }
public TorSocks5FailureResponseException(RepField rep) : base($"Tor SOCKS5 proxy responded with {rep}.")
{
- _repField = Guard.NotNull(nameof(rep), rep);
+ RepField = Guard.NotNull(nameof(rep), rep);
}
}
}

MODIFY
WalletWasabi/TorSocks5/TorHttpClient.cs
WalletWasabi/TorSocks5/TorHttpClient.cs
@@ -111,7 +111,7 @@ namespace WalletWasabi.TorSocks5
return ret2;
}
// If we get ttlexpired then wait and retry again linux often do this.
- catch (TorSocks5FailureResponseException ex2) when (ex2._repField == RepField.TtlExpired)
+ catch (TorSocks5FailureResponseException ex2) when (ex2.RepField == RepField.TtlExpired)
{
Logger.LogTrace<TorHttpClient>(ex);

MODIFY
WalletWasabi/TorSocks5/TorProcessManager.cs
WalletWasabi/TorSocks5/TorProcessManager.cs
@@ -274,7 +274,7 @@ namespace WalletWasabi.TorSocks5
{
if (TorHttpClient.LatestTorException is TorSocks5FailureResponseException torEx)
{
- if (torEx._repField == RepField.HostUnreachable)
+ if (torEx.RepField == RepField.HostUnreachable)
{
Uri baseUri = new Uri($"{fallBackTestRequestUri.Scheme}://{fallBackTestRequestUri.DnsSafeHost}");
using (var client = new TorHttpClient(baseUri, TorSocks5EndPoint))
@@ -284,7 +284,7 @@ namespace WalletWasabi.TorSocks5
}
// Check if it changed in the meantime...
- if (TorHttpClient.LatestTorException is TorSocks5FailureResponseException torEx2 && torEx2._repField == RepField.HostUnreachable)
+ if (TorHttpClient.LatestTorException is TorSocks5FailureResponseException torEx2 && torEx2.RepField == RepField.HostUnreachable)
{
// Fallback here...
RequestFallbackAddressUsage = true;

Replace a field by a readonly auto-property (getter)