Trace call to _uv_unsafe_async_send in MockLibuv.

This commit is contained in:
Cesar Blum Silveira 2016-08-08 15:21:19 -07:00
parent 56d09500a6
commit 5181e4196c
1 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading;
using Microsoft.AspNetCore.Server.Kestrel.Internal.Networking;
@ -12,9 +15,13 @@ namespace Microsoft.AspNetCore.Server.KestrelTests.TestHelpers
private bool _stopLoop;
private readonly ManualResetEventSlim _loopWh = new ManualResetEventSlim();
private readonly string _stackTrace;
unsafe public MockLibuv()
: base(onlyForTesting: true)
{
_stackTrace = Environment.StackTrace;
OnWrite = (socket, buffers, triggerCompleted) =>
{
triggerCompleted(0);
@ -76,6 +83,10 @@ namespace Microsoft.AspNetCore.Server.KestrelTests.TestHelpers
_uv_strerror = errno => IntPtr.Zero;
_uv_read_start = UvReadStart;
_uv_read_stop = handle => 0;
_uv_unsafe_async_send = handle =>
{
throw new Exception($"Why is this getting called?{Environment.NewLine}{_stackTrace}");
};
}
public Func<UvStreamHandle, int, Action<int>, int> OnWrite { get; set; }