Dispose when transport fails.
MODIFY
WalletWasabi/Tor/Http/TorHttpClient.cs
WalletWasabi/Tor/Http/TorHttpClient.cs
@@ -202,11 +202,20 @@ namespace WalletWasabi.Tor.Http
Stream transportStream = TorSocks5Client.GetTransportStream();
+ try
+ {
await transportStream.WriteAsync(bytes.AsMemory(0, bytes.Length), token).ConfigureAwait(false);
await transportStream.FlushAsync(token).ConfigureAwait(false);
return await HttpResponseMessageExtensions.CreateNewAsync(transportStream, request.Method).ConfigureAwait(false);
}
+ catch
+ {
+ TorSocks5Client?.Dispose();
+ TorSocks5Client = null;
+ throw;
+ }
+ }
#region IDisposable Support

Dispose when transport fails.