TorControlClient: Handle IOException when Tor control TCP connection is forcibly closed.
MODIFY
WalletWasabi/Tor/Control/TorControlClient.cs
WalletWasabi/Tor/Control/TorControlClient.cs
using Nito.AsyncEx;
using System;
using System.Collections.Generic;
+using System.IO;
using System.IO.Pipelines;
using System.Linq;
using System.Net.Sockets;
@@ -418,6 +419,10 @@ namespace WalletWasabi.Tor.Control
{
Logger.LogTrace("Reader loop was stopped.");
}
+ catch (IOException e)
+ {
+ Logger.LogError("Reply reader failed to read from pipe. Internal stream was most likely forcefully closed.", e);
+ }
catch (Exception e)
{
// This is an unrecoverable issue.

MODIFY
WalletWasabi/Tor/Control/TorControlReplyReader.cs
WalletWasabi/Tor/Control/TorControlReplyReader.cs
@@ -18,6 +18,7 @@ namespace WalletWasabi.Tor.Control
/// <para>However, such implementation is available <see href="https://github.com/zcash/zcash/pull/2251">here</see>.</para>
/// </remarks>
/// <exception cref="OperationCanceledException">When operation is canceled.</exception>
+ /// <exception cref="IOException">When reading fails because the internal stream is forcibly closed, etc.</exception>
/// <exception cref="TorControlReplyParseException">When received message does not follow Tor Control reply grammar.</exception>
/// <seealso href="https://gitweb.torproject.org/torspec.git/tree/control-spec.txt">See section "4. Replies".</seealso>
/// <seealso href="https://github.com/lontivero/Torino/blob/d891616777ed596ef54dbf1d86c9b4771e45e8f3/src/Reply.cs#L72"/>

TorControlClient: Handle IOException when Tor control TCP connection is forcibly closed.