Add Win10+ checks
MODIFY
WalletWasabi/Services/SleepInhibitor.cs
WalletWasabi/Services/SleepInhibitor.cs
@@ -56,6 +56,12 @@ public class SleepInhibitor : PeriodicRunner
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
+ // Windows 7 does not support the API we use.
+ if (Environment.OSVersion.Version.Major < 10)
+ {
+ return null;
+ }
+
taskFactory = () => Task.FromResult<IPowerSavingInhibitorTask>(WindowsPowerAvailabilityTask.Create(Reason));
}

MODIFY
WalletWasabi/Tor/Socks5/TorTcpConnectionFactory.cs
WalletWasabi/Tor/Socks5/TorTcpConnectionFactory.cs
@@ -2,6 +2,7 @@ using System.IO;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
+using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Helpers;
@@ -71,6 +72,10 @@ public class TorTcpConnectionFactory
{
tcpClient = new(TorSocks5EndPoint.AddressFamily);
tcpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
+
+ // Windows 7 does not support the API we use.
+ if (!(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && Environment.OSVersion.Version.Major < 10))
+ {
try
{
tcpClient.Client.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, 30);
@@ -81,6 +86,7 @@ public class TorTcpConnectionFactory
{
Logger.LogWarning("KeepAlive settings are not allowed by your OS. Ignoring.");
}
+ }
transportStream = await ConnectAsync(tcpClient, cancellationToken).ConfigureAwait(false);
await HandshakeAsync(tcpClient, circuit, cancellationToken).ConfigureAwait(false);
@@ -260,7 +266,7 @@ public class TorTcpConnectionFactory
}
// Do not check the Bnd. Address and Bnd. Port. because Tor does not seem to return any, ever. It returns zeros instead.
- // Generally also do not check anything but the success response, according to Socks5 RFC
+ // Generally also do not check anything but the success response, according to Socks5 RFC.
// If the reply code(REP value of X'00') indicates a success, and the
// request was either a BIND or a CONNECT, the client may now start

Add Win10+ checks