Remove TorDisposableBase.
MODIFY
WalletWasabi/CoinJoin/Client/Clients/AliceClientBase.cs
WalletWasabi/CoinJoin/Client/Clients/AliceClientBase.cs
@@ -10,8 +10,9 @@ using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.CoinJoin.Common.Models;
using WalletWasabi.Logging;
-using WalletWasabi.Tor.Http.Bases;
+using WalletWasabi.Tor.Http;
using WalletWasabi.Tor.Http.Extensions;
+using WalletWasabi.Tor.Http.Interfaces;
using WalletWasabi.Tor.Socks5.Exceptions;
using WalletWasabi.WebClients.Wasabi;
using static WalletWasabi.Crypto.SchnorrBlinding;
@@ -19,17 +20,19 @@ using UnblindedSignature = WalletWasabi.Crypto.UnblindedSignature;
namespace WalletWasabi.CoinJoin.Client.Clients
{
- public abstract class AliceClientBase : TorDisposableBase
+ public abstract class AliceClientBase : IDisposable
{
- /// <inheritdoc/>
+ private volatile bool _disposedValue = false; // To detect redundant calls
+
protected AliceClientBase(
long roundId,
IEnumerable<BitcoinAddress> registeredAddresses,
IEnumerable<Requester> requesters,
Network network,
Func<Uri> baseUriAction,
- EndPoint torSocks5EndPoint) : base(baseUriAction, torSocks5EndPoint)
+ EndPoint torSocks5EndPoint)
{
+ TorClient = new TorHttpClient(baseUriAction, torSocks5EndPoint, isolateStream: true);
RoundId = roundId;
RegisteredAddresses = registeredAddresses.ToArray();
Requesters = requesters.ToArray();
@@ -44,6 +47,8 @@ namespace WalletWasabi.CoinJoin.Client.Clients
public BitcoinAddress[] RegisteredAddresses { get; }
public Requester[] Requesters { get; }
+ public ITorHttpClient TorClient { get; }
+
public static async Task<AliceClient4> CreateNewAsync(
long roundId,
IEnumerable<BitcoinAddress> registeredAddresses,
@@ -210,5 +215,25 @@ namespace WalletWasabi.CoinJoin.Client.Clients
}
Logger.LogInfo($"Round ({RoundId}), Alice ({UniqueId}): Posted {signatures.Count} signatures.");
}
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ if (disposing)
+ {
+ (TorClient as IDisposable)?.Dispose();
+ }
+
+ _disposedValue = true;
+ }
+ }
+
+ // This code added to correctly implement the disposable pattern.
+ public void Dispose()
+ {
+ // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
+ Dispose(true);
+ }
}
}

DELETE
WalletWasabi/Tor/Http/Bases/TorDisposableBase.cs
-using System;
-using System.Net;
-using WalletWasabi.Tor.Http.Interfaces;
-
-namespace WalletWasabi.Tor.Http.Bases
-{
- public abstract class TorDisposableBase : IDisposable
- {
- private volatile bool _disposedValue = false; // To detect redundant calls
-
- /// <param name="torSocks5EndPoint">If null, then localhost:9050</param>
- protected TorDisposableBase(Uri baseUri, EndPoint? torSocks5EndPoint)
- {
- TorClient = new TorHttpClient(baseUri, torSocks5EndPoint, isolateStream: true);
- }
-
- /// <param name="torSocks5EndPoint">If null, then localhost:9050</param>
- protected TorDisposableBase(Func<Uri> baseUriAction, EndPoint? torSocks5EndPoint)
- {
- TorClient = new TorHttpClient(baseUriAction, torSocks5EndPoint, isolateStream: true);
- }
-
- public ITorHttpClient TorClient { get; }
-
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposedValue)
- {
- if (disposing)
- {
- (TorClient as IDisposable)?.Dispose();
- }
-
- _disposedValue = true;
- }
- }
-
- // This code added to correctly implement the disposable pattern.
- public void Dispose()
- {
- // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
- Dispose(true);
- }
- }
-}

Remove TorDisposableBase.