Fix for Ubuntu 20.04
Tor restarting behaves on Ubuntu slightly differently than on Windows for some reason.
MODIFY
WalletWasabi/Tor/Control/PipeReaderLineReaderExtension.cs
WalletWasabi/Tor/Control/PipeReaderLineReaderExtension.cs
@@ -93,7 +93,7 @@ namespace WalletWasabi.Tor.Control
}
}
- throw new InvalidDataException("This should never happen.");
+ throw new InvalidDataException("No more data.");
}
/// <summary>Finds the first newline (<c>\r\n</c>) in the buffer.</summary>

MODIFY
WalletWasabi/Tor/Control/TorControlClient.cs
WalletWasabi/Tor/Control/TorControlClient.cs
@@ -423,6 +423,10 @@ namespace WalletWasabi.Tor.Control
{
Logger.LogError("Reply reader failed to read from pipe. Internal stream was most likely forcefully closed.", e);
}
+ catch (TorControlReplyParseException e) when (e.Message == "No reply line was received.")
+ {
+ Logger.LogError("Incomplete Tor control reply was received. Tor probably terminated abruptly.", e);
+ }
catch (Exception e)
{
// This is an unrecoverable issue.
@@ -444,15 +448,23 @@ namespace WalletWasabi.Tor.Control
}
catch (Exception e)
{
- Logger.LogDebug("Tor process might have terminated.");
+ Logger.LogDebug("Tor process might have terminated, so we cannot unsubscribe Tor events.");
Logger.LogTrace(e);
}
// Stop reader loop.
ReaderCts.Cancel();
+ try
+ {
// Wait until the reader loop stops.
await ReaderLoopTask.ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ Logger.LogDebug("Tor process might have terminated and so the reading loop might have terminated abruptly.");
+ Logger.LogTrace(e);
+ }
ReaderCts.Dispose();
TcpClient?.Dispose();

Fix for Ubuntu 20.04

Tor restarting behaves on Ubuntu slightly differently than on Windows for some reason.