diff --git a/benchmarks/ClusterBenchmark/Program.cs b/benchmarks/ClusterBenchmark/Program.cs index 8ba2aef525..48db12b114 100644 --- a/benchmarks/ClusterBenchmark/Program.cs +++ b/benchmarks/ClusterBenchmark/Program.cs @@ -31,7 +31,6 @@ public static class Program public static async Task Main(string[] args) { - //AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); // ThreadPool.SetMinThreads(500, 500); Request = new HelloRequest(); Configuration.SetupLogger(LogLevel.Error); diff --git a/benchmarks/GossipBenchmark/Node1/Program.cs b/benchmarks/GossipBenchmark/Node1/Program.cs index 683e656d06..b9ac411387 100644 --- a/benchmarks/GossipBenchmark/Node1/Program.cs +++ b/benchmarks/GossipBenchmark/Node1/Program.cs @@ -30,8 +30,6 @@ private static async Task Main() ); var logger = Log.CreateLogger("benchmark"); - // Required to allow unencrypted GrpcNet connections - AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); var system = new ActorSystem( new ActorSystemConfig() .WithDeveloperSupervisionLogging(true) diff --git a/benchmarks/GossipBenchmark/Node2/Program.cs b/benchmarks/GossipBenchmark/Node2/Program.cs index 19e726b339..b6bcc54615 100644 --- a/benchmarks/GossipBenchmark/Node2/Program.cs +++ b/benchmarks/GossipBenchmark/Node2/Program.cs @@ -49,8 +49,6 @@ private static async Task Main() var logger = Log.CreateLogger("benchmark"); - // Required to allow unencrypted GrpcNet connections - AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); var system = new ActorSystem( new ActorSystemConfig() .WithDeveloperSupervisionLogging(true) diff --git a/benchmarks/RemoteBenchmark/Node1/Program.cs b/benchmarks/RemoteBenchmark/Node1/Program.cs index fe1692756b..771f3d869d 100644 --- a/benchmarks/RemoteBenchmark/Node1/Program.cs +++ b/benchmarks/RemoteBenchmark/Node1/Program.cs @@ -33,9 +33,6 @@ private static async Task Main() ); var logger = Log.CreateLogger(); -#if NETCOREAPP3_1 - AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); -#endif var serverRemote = 0; diff --git a/examples/ClusterGrainHelloWorld/Node1/Program.cs b/examples/ClusterGrainHelloWorld/Node1/Program.cs index af0e75c1e9..c090d3a2c3 100644 --- a/examples/ClusterGrainHelloWorld/Node1/Program.cs +++ b/examples/ClusterGrainHelloWorld/Node1/Program.cs @@ -20,9 +20,6 @@ Log.SetLoggerFactory( LoggerFactory.Create(l => l.AddConsole().SetMinimumLevel(LogLevel.Information))); -// Required to allow unencrypted GrpcNet connections -// AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); - var system = new ActorSystem() .WithRemote(RemoteConfig.BindToLocalhost().WithProtoMessages(ProtosReflection.Descriptor)) .WithCluster(ClusterConfig diff --git a/examples/ClusterGrainHelloWorld/Node2/Program.cs b/examples/ClusterGrainHelloWorld/Node2/Program.cs index 8acbbe3392..fa9a28b9be 100644 --- a/examples/ClusterGrainHelloWorld/Node2/Program.cs +++ b/examples/ClusterGrainHelloWorld/Node2/Program.cs @@ -21,9 +21,6 @@ Log.SetLoggerFactory( LoggerFactory.Create(l => l.AddConsole().SetMinimumLevel(LogLevel.Information))); -// Required to allow unencrypted GrpcNet connections -// AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); - var system = new ActorSystem(new ActorSystemConfig().WithDeveloperSupervisionLogging(true)) .WithRemote(RemoteConfig.BindToLocalhost(8090).WithProtoMessages(ProtosReflection.Descriptor)) .WithCluster(ClusterConfig diff --git a/examples/ClusterK8sGrains/Node1/Program.cs b/examples/ClusterK8sGrains/Node1/Program.cs index be7ddef387..e798c437de 100644 --- a/examples/ClusterK8sGrains/Node1/Program.cs +++ b/examples/ClusterK8sGrains/Node1/Program.cs @@ -33,9 +33,6 @@ .AddFilter("Proto.Cluster.Gossip", LogLevel.Information) .AddFilter("Proto.Context.ActorContext", LogLevel.Information))); -// Required to allow unencrypted GrpcNet connections -AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); - var kubernetesProvider = new KubernetesProvider(); var advertisedHost = await kubernetesProvider.GetPodFqdn(); diff --git a/examples/ClusterK8sGrains/Node2/Program.cs b/examples/ClusterK8sGrains/Node2/Program.cs index fb2f11e975..bbdfee1de6 100644 --- a/examples/ClusterK8sGrains/Node2/Program.cs +++ b/examples/ClusterK8sGrains/Node2/Program.cs @@ -34,9 +34,6 @@ .AddFilter("Proto.Cluster.Gossip", LogLevel.Information) .AddFilter("Proto.Context.ActorContext", LogLevel.Information))); -// Required to allow unencrypted GrpcNet connections -AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); - var kubernetesProvider = new KubernetesProvider(); var advertisedHost = await kubernetesProvider.GetPodFqdn(); diff --git a/src/Proto.Actor/Timers/Scheduler.cs b/src/Proto.Actor/Timers/Scheduler.cs index bc875a296d..f42621f6c8 100644 --- a/src/Proto.Actor/Timers/Scheduler.cs +++ b/src/Proto.Actor/Timers/Scheduler.cs @@ -17,9 +17,7 @@ namespace Proto.Timers; public class Scheduler { private readonly ISenderContext _context; -#if NET8_0_OR_GREATER private readonly TimeProvider _timeProvider; -#endif /// /// Creates a new scheduler. @@ -28,13 +26,9 @@ public class Scheduler public Scheduler(ISenderContext context) { _context = context; - -#if NET8_0_OR_GREATER _timeProvider = TimeProvider.System; -#endif } -#if NET8_0_OR_GREATER /// /// Creates a new scheduler. /// @@ -45,7 +39,6 @@ public Scheduler(ISenderContext context, TimeProvider timeProvider) _context = context; _timeProvider = timeProvider; } -#endif /// /// Schedules a single message to be sent in the future. @@ -141,10 +134,6 @@ public CancellationTokenSource RequestRepeatedly(TimeSpan delay, TimeSpan interv private async Task Delay(TimeSpan delay, CancellationToken token) { -#if NET8_0_OR_GREATER - await Task.Delay(delay, _timeProvider, token).ConfigureAwait(false); -#else - await Task.Delay(delay, token).ConfigureAwait(false); -#endif + await Task.Delay(delay, _timeProvider, token).ConfigureAwait(false); } -} \ No newline at end of file +} diff --git a/src/Proto.Actor/Timers/TimerExtensions.cs b/src/Proto.Actor/Timers/TimerExtensions.cs index 7d06f7e44e..3b6e46565b 100644 --- a/src/Proto.Actor/Timers/TimerExtensions.cs +++ b/src/Proto.Actor/Timers/TimerExtensions.cs @@ -10,8 +10,7 @@ public static class TimerExtensions /// /// public static Scheduler Scheduler(this ISenderContext context) => new(context); - -#if NET8_0_OR_GREATER + /// /// Gets a new scheduler that allows to schedule messages in the future /// @@ -19,5 +18,4 @@ public static class TimerExtensions /// TimeProvider to use for scheduling (FakeTimeProvider can be used for testing) /// public static Scheduler Scheduler(this ISenderContext context, TimeProvider timeProvider) => new(context, timeProvider); -#endif -} \ No newline at end of file +} diff --git a/tests/Proto.Actor.Tests/SchedulerTests.cs b/tests/Proto.Actor.Tests/SchedulerTests.cs index 26d443de38..a5d6ca8a73 100644 --- a/tests/Proto.Actor.Tests/SchedulerTests.cs +++ b/tests/Proto.Actor.Tests/SchedulerTests.cs @@ -1,4 +1,3 @@ -#if NET8_0_OR_GREATER using System; using System.Threading.Tasks; using System.Threading; @@ -178,4 +177,4 @@ public async Task RequestRepeatedlyCanBeCancelled() Assert.False(extraResponse.Task.IsCompleted); } } -#endif + diff --git a/tests/Proto.Actor.Tests/TimerExtensionsTests.cs b/tests/Proto.Actor.Tests/TimerExtensionsTests.cs index 3371d04cdc..35206472e6 100644 --- a/tests/Proto.Actor.Tests/TimerExtensionsTests.cs +++ b/tests/Proto.Actor.Tests/TimerExtensionsTests.cs @@ -2,9 +2,7 @@ using System.Threading.Tasks; using Proto.Timers; using Xunit; -#if NET8_0_OR_GREATER using Microsoft.Extensions.Time.Testing; -#endif namespace Proto.Tests; @@ -38,7 +36,6 @@ public async Task SchedulerSchedulesMessageAfterDelay() await tcs.Task.WaitAsync(TimeSpan.FromSeconds(5)); } -#if NET8_0_OR_GREATER [Fact] public async Task SchedulerWithTimeProviderSchedulesMessageAfterDelay() { @@ -67,5 +64,5 @@ public async Task SchedulerWithTimeProviderSchedulesMessageAfterDelay() await tcs.Task.WaitAsync(TimeSpan.FromMilliseconds(10)); } -#endif } + diff --git a/tests/Proto.Cluster.MongoIdentity.Tests/MongoIdentityTests.cs b/tests/Proto.Cluster.MongoIdentity.Tests/MongoIdentityTests.cs index 9ede452821..6297150bcf 100644 --- a/tests/Proto.Cluster.MongoIdentity.Tests/MongoIdentityTests.cs +++ b/tests/Proto.Cluster.MongoIdentity.Tests/MongoIdentityTests.cs @@ -18,9 +18,6 @@ public class MongoIdentityClusterFixture : BaseInMemoryClusterFixture public MongoIdentityClusterFixture() : base(3, config => config with { ActorActivationTimeout = TimeSpan.FromSeconds(10) }) { -#if NETCOREAPP3_1 - AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); -#endif } protected override IIdentityLookup GetIdentityLookup(string clusterName) @@ -95,4 +92,5 @@ public MongoStorageTests(ITestOutputHelper testOutputHelper) : base(Init, testOu private static IIdentityStorage Init(string clusterName) => new MongoIdentityStorage(clusterName, MongoFixture.Database.GetCollection("pids")); -} \ No newline at end of file +} + diff --git a/tests/Proto.Cluster.RedisIdentity.Tests/RedisIdentityTests.cs b/tests/Proto.Cluster.RedisIdentity.Tests/RedisIdentityTests.cs index 1c28a9659c..9ca895441c 100644 --- a/tests/Proto.Cluster.RedisIdentity.Tests/RedisIdentityTests.cs +++ b/tests/Proto.Cluster.RedisIdentity.Tests/RedisIdentityTests.cs @@ -19,9 +19,6 @@ public class RedisIdentityClusterFixture : BaseInMemoryClusterFixture { public RedisIdentityClusterFixture() : base(3) { -#if NETCOREAPP3_1 - AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); -#endif } protected override IIdentityLookup GetIdentityLookup(string clusterName) @@ -94,4 +91,5 @@ private static IIdentityStorage Init(string clusterName) => RedisFixture.Multiplexer, TimeSpan.FromMilliseconds(1500) ); -} \ No newline at end of file +} + diff --git a/tests/Proto.Remote.Tests/RemoteFixture.cs b/tests/Proto.Remote.Tests/RemoteFixture.cs index 993fe0ca27..59cafca215 100644 --- a/tests/Proto.Remote.Tests/RemoteFixture.cs +++ b/tests/Proto.Remote.Tests/RemoteFixture.cs @@ -72,9 +72,6 @@ protected static TRemoteConfig ConfigureClientRemoteConfig(TRemot protected static (IHost, HostedGrpcNetRemote) GetHostedGrpcNetRemote(RemoteConfig config) { -#if NETCOREAPP3_1 - AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); -#endif var hostBuilder = Host.CreateDefaultBuilder(Array.Empty()) .ConfigureServices(services => { @@ -120,17 +117,12 @@ protected static (IHost, HostedGrpcNetRemote) GetHostedGrpcNetRemote(RemoteConfi protected static GrpcNetRemote GetGrpcNetRemote(RemoteConfig config) { -#if NETCOREAPP3_1 - AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); -#endif return new GrpcNetRemote(new ActorSystem(), config); } protected static GrpcNetClientRemote GetGrpcNetClientRemote(RemoteConfig config) { -#if NETCOREAPP3_1 - AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); -#endif return new GrpcNetClientRemote(new ActorSystem(), config); } -} \ No newline at end of file +} +