diff --git a/benchmark/BDN.benchmark/Embedded/EmbeddedNetworkHandler.cs b/benchmark/BDN.benchmark/Embedded/EmbeddedNetworkHandler.cs index 0dc367cd7f..7bb94f21cf 100644 --- a/benchmark/BDN.benchmark/Embedded/EmbeddedNetworkHandler.cs +++ b/benchmark/BDN.benchmark/Embedded/EmbeddedNetworkHandler.cs @@ -30,7 +30,11 @@ public async ValueTask Send(Request request) networkReceiveBuffer = request.buffer; unsafe { networkReceiveBufferPtr = request.bufferPtr; } - await OnNetworkReceiveAsync(request.buffer.Length); + var task = OnNetworkReceiveAsync(request.buffer.Length); + if (!task.IsCompletedSuccessfully) + { + await task; + } Debug.Assert(networkBytesRead == 0); Debug.Assert(networkReadHead == 0); diff --git a/benchmark/BDN.benchmark/Network/BasicOperations.cs b/benchmark/BDN.benchmark/Network/BasicOperations.cs index deda2d4955..192d6ddaf3 100644 --- a/benchmark/BDN.benchmark/Network/BasicOperations.cs +++ b/benchmark/BDN.benchmark/Network/BasicOperations.cs @@ -24,7 +24,11 @@ public override void GlobalSetup() [Benchmark] public async ValueTask InlinePing() { - await Send(ping); + var task = Send(ping); + if (!task.IsCompletedSuccessfully) + { + await task; + } } } } \ No newline at end of file