diff --git a/Directory.Build.props b/Directory.Build.props
index 93fee60d5..f3ae0ed05 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -25,7 +25,7 @@
- netcoreapp3.1
+ net5.0;netcoreapp3.1
True
$(SourceRoot)/build/DotNetty.snk
diff --git a/build/Dependencies.CuteAnt.props b/build/Dependencies.CuteAnt.props
index 13b612ecd..5cc43cb97 100644
--- a/build/Dependencies.CuteAnt.props
+++ b/build/Dependencies.CuteAnt.props
@@ -135,16 +135,16 @@
1.4.2009.1814
1.4.2009.1814
- 1.0.0-beta-210610
- 1.0.0-beta-210610
- 1.0.0-beta-210610
- 1.0.0-beta-210610
- 1.0.0-beta-210610
- 1.0.0-beta-210610
- 1.0.0-beta-210610
- 1.0.0-beta-210610
- 1.0.0-beta-210610
- 1.0.0-beta-210610
+ 1.0.0-beta-210716
+ 1.0.0-beta-210716
+ 1.0.0-beta-210716
+ 1.0.0-beta-210716
+ 1.0.0-beta-210716
+ 1.0.0-beta-210716
+ 1.0.0-beta-210716
+ 1.0.0-beta-210716
+ 1.0.0-beta-210716
+ 1.0.0-beta-210716
0.9.16-rtm-200824-01
diff --git a/buildNetstandard.fsx b/buildNetstandard.fsx
index 622041360..289f95d58 100644
--- a/buildNetstandard.fsx
+++ b/buildNetstandard.fsx
@@ -220,18 +220,14 @@ Target "RunTests" (fun _ ->
let projects =
let rawProjects = match (isWindows) with
| true -> !! "./test/*.Tests.Netstandard/*.Tests.csproj"
- -- "./test/*.Tests.Netstandard/DotNetty.Transport.Tests.csproj"
- -- "./test/*.Tests.Netstandard/DotNetty.Suite.Tests.csproj"
| _ -> !! "./test/*.Tests.Netstandard/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here
- -- "./test/*.Tests.Netstandard/DotNetty.Transport.Tests.csproj"
- -- "./test/*.Tests.Netstandard/DotNetty.Suite.Tests.csproj"
rawProjects |> Seq.choose filterProjects
let runSingleProject project =
let arguments =
match (hasTeamCity) with
- | true -> (sprintf "test -c Debug --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s -- RunConfiguration.TargetPlatform=x64 --results-directory \"%s\" -- -parallel none -teamcity" testNetCoreVersion outputTests)
- | false -> (sprintf "test -c Debug --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s -- RunConfiguration.TargetPlatform=x64 --results-directory \"%s\" -- -parallel none" testNetCoreVersion outputTests)
+ | true -> (sprintf "test -c Debug --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s -- RunConfiguration.TargetPlatform=x64 --results-directory \"%s\" -- -parallel none -teamcity" testNetVersion outputTests)
+ | false -> (sprintf "test -c Debug --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s -- RunConfiguration.TargetPlatform=x64 --results-directory \"%s\" -- -parallel none" testNetVersion outputTests)
let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
diff --git a/examples/Http2Helloworld.Client/Http2ClientInitializer.cs b/examples/Http2Helloworld.Client/Http2ClientInitializer.cs
index c1d88006f..c690f5457 100644
--- a/examples/Http2Helloworld.Client/Http2ClientInitializer.cs
+++ b/examples/Http2Helloworld.Client/Http2ClientInitializer.cs
@@ -79,30 +79,21 @@ protected void ConfigureEndOfPipeline(IChannelPipeline pipeline)
void ConfigureSsl(IChannel ch)
{
var pipeline = ch.Pipeline;
- pipeline.AddLast("tls", new TlsHandler(
- stream => new SslStream(stream, true, (sender, certificate, chain, errors) => true),
- new ClientTlsSettings(_targetHost)
-#if NETCOREAPP_2_0_GREATER
+ var tlsSettings = new ClientTlsSettings(_targetHost)
+ {
+ ApplicationProtocols = new List(new[]
{
- ApplicationProtocols = new List(new[]
- {
- SslApplicationProtocol.Http2,
- SslApplicationProtocol.Http11
- })
- }
-#endif
- ));
+ SslApplicationProtocol.Http2,
+ SslApplicationProtocol.Http11
+ })
+ }.AllowAnyServerCertificate();
+ pipeline.AddLast("tls", new TlsHandler(tlsSettings));
// We must wait for the handshake to finish and the protocol to be negotiated before configuring
// the HTTP/2 components of the pipeline.
-#if NETCOREAPP_2_0_GREATER
pipeline.AddLast(new ClientApplicationProtocolNegotiationHandler(this));
-#else
- this.ConfigureClearText(ch);
-#endif
}
-#if NETCOREAPP_2_0_GREATER
sealed class ClientApplicationProtocolNegotiationHandler : ApplicationProtocolNegotiationHandler
{
readonly Http2ClientInitializer _self;
@@ -126,7 +117,6 @@ protected override void ConfigurePipeline(IChannelHandlerContext ctx, SslApplica
throw new InvalidOperationException("unknown protocol: " + protocol);
}
}
-#endif
///
/// Configure the pipeline for a cleartext upgrade from HTTP to HTTP/2.
diff --git a/examples/Http2Helloworld.FrameClient/Http2ClientFrameInitializer.cs b/examples/Http2Helloworld.FrameClient/Http2ClientFrameInitializer.cs
index 10547a3a3..25aee6b7d 100644
--- a/examples/Http2Helloworld.FrameClient/Http2ClientFrameInitializer.cs
+++ b/examples/Http2Helloworld.FrameClient/Http2ClientFrameInitializer.cs
@@ -26,17 +26,15 @@ protected override void InitChannel(IChannel ch)
var pipeline = ch.Pipeline;
if (_cert is object)
{
- pipeline.AddLast("tls", new TlsHandler(
- stream => new SslStream(stream, true, (sender, certificate, chain, errors) => true),
- new ClientTlsSettings(_targetHost)
+ var tlsSettings = new ClientTlsSettings(_targetHost)
+ {
+ ApplicationProtocols = new List(new[]
{
- ApplicationProtocols = new List(new[]
- {
- SslApplicationProtocol.Http2,
- //SslApplicationProtocol.Http11
- })
- }
- ));
+ SslApplicationProtocol.Http2,
+ SslApplicationProtocol.Http11
+ })
+ }.AllowAnyServerCertificate();
+ pipeline.AddLast("tls", new TlsHandler(tlsSettings));
}
var build = Http2FrameCodecBuilder.ForClient();
build.InitialSettings = Http2Settings.DefaultSettings(); // this is the default, but shows it can be changed.
diff --git a/examples/Http2Helloworld.FrameServer/Http2ServerInitializer.cs b/examples/Http2Helloworld.FrameServer/Http2ServerInitializer.cs
index e9b64d7c9..240a9b996 100644
--- a/examples/Http2Helloworld.FrameServer/Http2ServerInitializer.cs
+++ b/examples/Http2Helloworld.FrameServer/Http2ServerInitializer.cs
@@ -53,23 +53,17 @@ protected override void InitChannel(IChannel channel)
*/
void ConfigureSsl(IChannel ch)
{
- ch.Pipeline.AddLast(new TlsHandler(new ServerTlsSettings(this.tlsCertificate)
-#if NETCOREAPP_2_0_GREATER
+ var tlsSettings = new ServerTlsSettings(this.tlsCertificate)
+ {
+ ApplicationProtocols = new List(new[]
{
- ApplicationProtocols = new List(new[]
- {
- SslApplicationProtocol.Http2,
- SslApplicationProtocol.Http11
- })
- }
-#endif
- ));
-#if NETCOREAPP_2_0_GREATER
+ SslApplicationProtocol.Http2,
+ SslApplicationProtocol.Http11
+ })
+ };
+ tlsSettings.AllowAnyClientCertificate();
+ ch.Pipeline.AddLast(new TlsHandler(tlsSettings));
ch.Pipeline.AddLast(new Http2OrHttpHandler());
-#else
- this.ConfigureClearText(ch);
-#endif
-
}
void ConfigureClearText(IChannel ch)
diff --git a/examples/Http2Helloworld.MultiplexServer/Http2ServerInitializer.cs b/examples/Http2Helloworld.MultiplexServer/Http2ServerInitializer.cs
index c4457aed3..21e6fb885 100644
--- a/examples/Http2Helloworld.MultiplexServer/Http2ServerInitializer.cs
+++ b/examples/Http2Helloworld.MultiplexServer/Http2ServerInitializer.cs
@@ -53,23 +53,17 @@ protected override void InitChannel(IChannel channel)
*/
void ConfigureSsl(IChannel ch)
{
- ch.Pipeline.AddLast(new TlsHandler(new ServerTlsSettings(this.tlsCertificate)
-#if NETCOREAPP_2_0_GREATER
+ var tlsSettings = new ServerTlsSettings(this.tlsCertificate)
{
ApplicationProtocols = new List(new[]
- {
- SslApplicationProtocol.Http2,
- SslApplicationProtocol.Http11
- })
- }
-#endif
- ));
-#if NETCOREAPP_2_0_GREATER
+ {
+ SslApplicationProtocol.Http2,
+ SslApplicationProtocol.Http11
+ })
+ };
+ //tlsSettings.AllowAnyClientCertificate();
+ ch.Pipeline.AddLast(new TlsHandler(tlsSettings));
ch.Pipeline.AddLast(new Http2OrHttpHandler());
-#else
- this.ConfigureClearText(ch);
-#endif
-
}
void ConfigureClearText(IChannel ch)
diff --git a/examples/Http2Helloworld.Server/Http2ServerInitializer.cs b/examples/Http2Helloworld.Server/Http2ServerInitializer.cs
index a4af02978..8d20bffea 100644
--- a/examples/Http2Helloworld.Server/Http2ServerInitializer.cs
+++ b/examples/Http2Helloworld.Server/Http2ServerInitializer.cs
@@ -53,23 +53,17 @@ protected override void InitChannel(IChannel channel)
*/
void ConfigureSsl(IChannel ch)
{
- ch.Pipeline.AddLast(new TlsHandler(new ServerTlsSettings(this.tlsCertificate)
-#if NETCOREAPP_2_0_GREATER
+ var tlsSettings = new ServerTlsSettings(this.tlsCertificate)
+ {
+ ApplicationProtocols = new List(new[]
{
- ApplicationProtocols = new List(new[]
- {
- SslApplicationProtocol.Http2,
- SslApplicationProtocol.Http11
- })
- }
-#endif
- ));
-#if NETCOREAPP_2_0_GREATER
+ SslApplicationProtocol.Http2,
+ SslApplicationProtocol.Http11
+ })
+ };
+ tlsSettings.AllowAnyClientCertificate();
+ ch.Pipeline.AddLast(new TlsHandler(tlsSettings));
ch.Pipeline.AddLast(new Http2OrHttpHandler());
-#else
- this.ConfigureClearText(ch);
-#endif
-
}
void ConfigureClearText(IChannel ch)
diff --git a/examples/Http2Helloworld.Server/Program.cs b/examples/Http2Helloworld.Server/Program.cs
index a720aa937..55247ade8 100644
--- a/examples/Http2Helloworld.Server/Program.cs
+++ b/examples/Http2Helloworld.Server/Program.cs
@@ -38,7 +38,6 @@ static async Task Main(string[] args)
+ $"\nProcessor Count : {Environment.ProcessorCount}\n");
bool useLibuv = ServerSettings.UseLibuv;
- useLibuv = false;
Console.WriteLine("Transport type : " + (useLibuv ? "Libuv" : "Socket"));
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
diff --git a/examples/Http2Tiles/Http2RequestHandler.cs b/examples/Http2Tiles/Http2RequestHandler.cs
index 9331130a4..f74d5ee89 100644
--- a/examples/Http2Tiles/Http2RequestHandler.cs
+++ b/examples/Http2Tiles/Http2RequestHandler.cs
@@ -75,7 +75,10 @@ protected virtual void SendResponse(IChannelHandlerContext ctx, string streamId,
HttpUtil.SetContentLength(response, response.Content.ReadableBytes);
StreamId(response, streamId);
- ctx.Executor.Schedule(() => ctx.WriteAndFlushAsync(response), TimeSpan.FromMilliseconds(latency));
+ ctx.Executor.Schedule(() =>
+ {
+ ctx.WriteAndFlushAsync(response);
+ }, TimeSpan.FromMilliseconds(latency));
}
private static string StreamId(IFullHttpRequest request)
diff --git a/examples/Http2Tiles/Http2Server.cs b/examples/Http2Tiles/Http2Server.cs
index 01314c2bc..eacd87ffe 100644
--- a/examples/Http2Tiles/Http2Server.cs
+++ b/examples/Http2Tiles/Http2Server.cs
@@ -8,6 +8,7 @@ namespace Http2Tiles
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
+ using DotNetty.Buffers;
using DotNetty.Handlers.Logging;
using DotNetty.Handlers.Tls;
using DotNetty.Transport.Bootstrapping;
@@ -25,19 +26,19 @@ public class Http2Server
{
public static readonly int PORT = int.Parse(ExampleHelper.Configuration["http2-port"]);
- readonly IEventLoopGroup bossGroup;
- readonly IEventLoopGroup workGroup;
+ readonly IEventLoopGroup _bossGroup;
+ readonly IEventLoopGroup _workGroup;
public Http2Server(IEventLoopGroup bossGroup, IEventLoopGroup workGroup)
{
- this.bossGroup = bossGroup;
- this.workGroup = workGroup;
+ _bossGroup = bossGroup;
+ _workGroup = workGroup;
}
public Task StartAsync()
{
var bootstrap = new ServerBootstrap();
- bootstrap.Group(this.bossGroup, this.workGroup);
+ bootstrap.Group(_bossGroup, _workGroup);
if (ServerSettings.UseLibuv)
{
@@ -59,19 +60,22 @@ public Task StartAsync()
bootstrap
.Option(ChannelOption.SoBacklog, 1024)
+ //.Option(ChannelOption.Allocator, UnpooledByteBufferAllocator.Default)
.Handler(new LoggingHandler("LSTN"))
.ChildHandler(new ActionChannelInitializer(ch =>
{
- ch.Pipeline.AddLast(new TlsHandler(new ServerTlsSettings(tlsCertificate)
+ var tlsSettings = new ServerTlsSettings(tlsCertificate)
{
ApplicationProtocols = new List(new[]
{
SslApplicationProtocol.Http2,
SslApplicationProtocol.Http11
})
- }));
+ };
+ tlsSettings.AllowAnyClientCertificate();
+ ch.Pipeline.AddLast(new TlsHandler(tlsSettings));
ch.Pipeline.AddLast(new Http2OrHttpHandler());
}));
diff --git a/examples/Http2Tiles/HttpServer.cs b/examples/Http2Tiles/HttpServer.cs
index 8f3a1b328..7e2e991fa 100644
--- a/examples/Http2Tiles/HttpServer.cs
+++ b/examples/Http2Tiles/HttpServer.cs
@@ -4,6 +4,7 @@ namespace Http2Tiles
using System.Net;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+ using DotNetty.Buffers;
using DotNetty.Codecs.Http;
using DotNetty.Handlers.Logging;
using DotNetty.Transport.Bootstrapping;
@@ -54,6 +55,7 @@ public Task StartAsync()
bootstrap
.Option(ChannelOption.SoBacklog, 1024)
+ //.Option(ChannelOption.Allocator, UnpooledByteBufferAllocator.Default)
.Handler(new LoggingHandler("LSTN"))
diff --git a/examples/WebSockets.Client/Program.cs b/examples/WebSockets.Client/Program.cs
index aaff7a0e4..061a648f1 100644
--- a/examples/WebSockets.Client/Program.cs
+++ b/examples/WebSockets.Client/Program.cs
@@ -89,7 +89,7 @@ static async Task Main(string[] args)
IChannelPipeline pipeline = channel.Pipeline;
if (cert != null)
{
- pipeline.AddLast("tls", new TlsHandler(stream => new SslStream(stream, true, (sender, certificate, chain, errors) => true), new ClientTlsSettings(targetHost)));
+ pipeline.AddLast("tls", new TlsHandler(new ClientTlsSettings(targetHost).AllowAnyServerCertificate()));
}
pipeline.AddLast("idleStateHandler", new IdleStateHandler(0, 0, 60));
diff --git a/examples/WebSockets.Server/Program.cs b/examples/WebSockets.Server/Program.cs
index c4ad45bfb..05422aa52 100644
--- a/examples/WebSockets.Server/Program.cs
+++ b/examples/WebSockets.Server/Program.cs
@@ -112,7 +112,7 @@ static async Task Main(string[] args)
IChannelPipeline pipeline = channel.Pipeline;
if (ServerSettings.IsSsl)
{
- pipeline.AddLast(TlsHandler.Server(tlsCertificate));
+ pipeline.AddLast(TlsHandler.Server(tlsCertificate, true));
}
pipeline.AddLast("idleStateHandler", new IdleStateHandler(0, 0, 120));
diff --git a/shared/contoso.com.pfx b/shared/contoso.com.pfx
index bacddeff7..a86447078 100644
Binary files a/shared/contoso.com.pfx and b/shared/contoso.com.pfx differ
diff --git a/shared/dotnetty.com.pfx b/shared/dotnetty.com.pfx
index 4b2c4f245..27fed55b4 100644
Binary files a/shared/dotnetty.com.pfx and b/shared/dotnetty.com.pfx differ
diff --git a/src/DotNetty.Buffers/CompositeByteBuffer.cs b/src/DotNetty.Buffers/CompositeByteBuffer.cs
index 8424e8f5a..c3d51743a 100644
--- a/src/DotNetty.Buffers/CompositeByteBuffer.cs
+++ b/src/DotNetty.Buffers/CompositeByteBuffer.cs
@@ -740,12 +740,6 @@ public override bool IsSingleIoBuffer
return _components[0].Buffer.IsSingleIoBuffer;
default:
return false;
- //int count = 0;
- //for (int i = 0; i < size; i++)
- //{
- // count += _components[i].Buffer.IoBufferCount;
- //}
- //return 1u >= (uint)count;
}
}
}
diff --git a/src/DotNetty.Codecs.Http/HttpServerUpgradeHandler.cs b/src/DotNetty.Codecs.Http/HttpServerUpgradeHandler.cs
index 28f7384fc..f9ac21c05 100644
--- a/src/DotNetty.Codecs.Http/HttpServerUpgradeHandler.cs
+++ b/src/DotNetty.Codecs.Http/HttpServerUpgradeHandler.cs
@@ -358,7 +358,7 @@ bool Upgrade(IChannelHandlerContext ctx, IFullHttpRequest request)
static readonly Action CloseOnFailureAction = (t, s) => CloseOnFailure(t, s);
static void CloseOnFailure(Task t, object s)
{
- if (!t.IsSuccess())
+ if (t.IsFailure())
{
_ = ((IChannelHandlerContext)s).Channel.CloseAsync();
}
diff --git a/src/DotNetty.Codecs.Http2/DefaultHttp2ConnectionEncoder.cs b/src/DotNetty.Codecs.Http2/DefaultHttp2ConnectionEncoder.cs
index c5fef11a2..15a9d89a1 100644
--- a/src/DotNetty.Codecs.Http2/DefaultHttp2ConnectionEncoder.cs
+++ b/src/DotNetty.Codecs.Http2/DefaultHttp2ConnectionEncoder.cs
@@ -583,11 +583,11 @@ private static void NotifyLifecycleManagerOnError(Task future, IHttp2LifecycleMa
private static readonly Action NotifyLifecycleManagerOnErrorAction = (t, s) => NotifyLifecycleManagerOnError0(t, s);
private static void NotifyLifecycleManagerOnError0(Task t, object s)
{
- var wrapped = ((IHttp2LifecycleManager, IChannelHandlerContext))s;
+ var (lm, ctx) = ((IHttp2LifecycleManager, IChannelHandlerContext))s;
var cause = t.Exception;
if (cause is object)
{
- wrapped.Item1.OnError(wrapped.Item2, true, cause.InnerException);
+ lm.OnError(ctx, true, cause.InnerException);
}
}
@@ -681,7 +681,7 @@ public FlowControlledBase(DefaultHttp2ConnectionEncoder encoder, IHttp2Stream st
private static readonly Action LinkOutcomeContinuationAction = (t, s) => LinkOutcomeContinuation(t, s);
private static void LinkOutcomeContinuation(Task task, object state)
{
- if (!task.IsSuccess())
+ if (task.IsFailure())
{
var self = (FlowControlledBase)state;
self.Error(self._owner.FlowController.ChannelHandlerContext, task.Exception.InnerException);
diff --git a/src/DotNetty.Codecs.Http2/DefaultHttp2RemoteFlowController.cs b/src/DotNetty.Codecs.Http2/DefaultHttp2RemoteFlowController.cs
index 139b02d59..12aa8ecc7 100644
--- a/src/DotNetty.Codecs.Http2/DefaultHttp2RemoteFlowController.cs
+++ b/src/DotNetty.Codecs.Http2/DefaultHttp2RemoteFlowController.cs
@@ -704,17 +704,29 @@ protected internal virtual void InitialWindowSize(int newWindowSize)
int delta = newWindowSize - _controller._initialWindowSize;
_controller._initialWindowSize = newWindowSize;
- _ = _controller._connection.ForEachActiveStream(Visit);
+ _ = _controller._connection.ForEachActiveStream(new Http2StreamVisitor(_controller, delta));
if (delta > 0 && _controller.IsChannelWritable())
{
// The window size increased, send any pending frames for all streams.
WritePendingBytes();
}
+ }
+
+ sealed class Http2StreamVisitor : IHttp2StreamVisitor
+ {
+ private readonly DefaultHttp2RemoteFlowController _rfc;
+ private readonly int _delta;
+
+ public Http2StreamVisitor(DefaultHttp2RemoteFlowController rfc, int delta)
+ {
+ _rfc = rfc;
+ _delta = delta;
+ }
- bool Visit(IHttp2Stream stream)
+ public bool Visit(IHttp2Stream stream)
{
- _ = _controller.GetState(stream).IncrementStreamWindow(delta);
+ _ = _rfc.GetState(stream).IncrementStreamWindow(_delta);
return true;
}
}
diff --git a/src/DotNetty.Codecs.Http2/Http2ConnectionHandler.cs b/src/DotNetty.Codecs.Http2/Http2ConnectionHandler.cs
index 075bb2d1b..b4f308047 100644
--- a/src/DotNetty.Codecs.Http2/Http2ConnectionHandler.cs
+++ b/src/DotNetty.Codecs.Http2/Http2ConnectionHandler.cs
@@ -981,7 +981,7 @@ private void ProcessRstStreamWriteResult(IChannelHandlerContext ctx, IHttp2Strea
private void CloseConnectionOnError(IChannelHandlerContext ctx, Task future)
{
- if (!future.IsSuccess())
+ if (future.IsFailure())
{
OnConnectionError(ctx, true, future.Exception.InnerException, null);
}
@@ -990,16 +990,15 @@ private void CloseConnectionOnError(IChannelHandlerContext ctx, Task future)
private static readonly Action CloseChannelOnCompleteAction = (t, s) => CloseChannelOnComplete(t, s);
private static void CloseChannelOnComplete(Task t, object s)
{
- var wrapped = ((IChannelHandlerContext, IPromise, IScheduledTask))s;
- _ = (wrapped.Item3?.Cancel());
- var promise = wrapped.Item2;
+ var (ctx, promise, timeoutTask) = ((IChannelHandlerContext, IPromise, IScheduledTask))s;
+ _ = timeoutTask?.Cancel();
if (promise is object)
{
- _ = wrapped.Item1.CloseAsync(promise);
+ _ = ctx.CloseAsync(promise);
}
else
{
- _ = wrapped.Item1.CloseAsync();
+ _ = ctx.CloseAsync();
}
}
private static readonly Action
protected long NextScheduledTaskNanos()
{
- if (ScheduledTaskQueue.TryPeek(out IScheduledRunnable nextScheduledRunnable))
+ if (_scheduledTaskQueue.TryPeek(out IScheduledRunnable nextScheduledRunnable))
{
return nextScheduledRunnable.DelayNanos;
}
@@ -155,7 +159,7 @@ protected long NextScheduledTaskNanos()
///
protected long NextScheduledTaskDeadlineNanos()
{
- if (ScheduledTaskQueue.TryPeek(out IScheduledRunnable nextScheduledRunnable))
+ if (_scheduledTaskQueue.TryPeek(out IScheduledRunnable nextScheduledRunnable))
{
return nextScheduledRunnable.DeadlineNanos;
}
@@ -165,9 +169,12 @@ protected long NextScheduledTaskDeadlineNanos()
[MethodImpl(InlineMethod.AggressiveOptimization)]
protected IScheduledRunnable PeekScheduledTask()
{
- //IPriorityQueue scheduledTaskQueue = ScheduledTaskQueue;
- //return !IsNullOrEmpty(scheduledTaskQueue) && scheduledTaskQueue.TryPeek(out IScheduledRunnable task) ? task : null;
- return ScheduledTaskQueue.TryPeek(out IScheduledRunnable task) ? task : null;
+ return _scheduledTaskQueue.TryPeek(out IScheduledRunnable task) ? task : null;
+ }
+
+ protected bool TryPeekScheduledTask(out IScheduledRunnable task)
+ {
+ return _scheduledTaskQueue.TryPeek(out task);
}
///
@@ -175,7 +182,7 @@ protected IScheduledRunnable PeekScheduledTask()
///
protected bool HasScheduledTasks()
{
- return ScheduledTaskQueue.TryPeek(out IScheduledRunnable scheduledTask) && scheduledTask.DeadlineNanos <= PreciseTime.NanoTime();
+ return _scheduledTaskQueue.TryPeek(out IScheduledRunnable scheduledTask) && scheduledTask.DeadlineNanos <= PreciseTime.NanoTime();
}
public override IScheduledTask Schedule(IRunnable action, TimeSpan delay)
@@ -486,7 +493,19 @@ public override Task ScheduleWithFixedDelayAsync(Action