TorControlClient: Do not throw an exception when Tor crashes.
MODIFY
WalletWasabi/Tor/Control/TorControlClient.cs
WalletWasabi/Tor/Control/TorControlClient.cs
@@ -258,9 +258,9 @@ namespace WalletWasabi.Tor.Control
/// <summary>Subscribes Tor control events by their names.</summary>
/// <remarks>If an event stream is already subscribed, no command is sent to Tor control.</remarks>
/// <param name="cancellationToken">
- /// Useful when the whole application stops. Otherwise, the internal state of this object may get corrupted.
+ /// Useful when the whole Tor process stops. Otherwise, the internal state of this object may get corrupted.
/// </param>
- public async Task SubscribeEventsAsync(string[] names, CancellationToken cancellationToken = default)
+ public async Task SubscribeEventsAsync(IEnumerable<string> names, CancellationToken cancellationToken = default)
{
using IDisposable _ = await MessageLock.LockAsync(cancellationToken).ConfigureAwait(false);
@@ -432,6 +432,8 @@ namespace WalletWasabi.Tor.Control
}
public async ValueTask DisposeAsync()
+ {
+ try
{
bool isOk = await UnsubscribeAllEventsAsync().ConfigureAwait(false);
@@ -439,6 +441,11 @@ namespace WalletWasabi.Tor.Control
{
Logger.LogWarning("Failed to unsubscribe all Tor control events.");
}
+ }
+ catch (Exception e)
+ {
+ Logger.LogDebug("Tor process might have terminated.", e);
+ }
// Stop reader loop.
ReaderCts.Cancel();

TorControlClient: Do not throw an exception when Tor crashes.