Skip to content

Commit 09966ae

Browse files
committed
Clean up shared code
1 parent b9e4eea commit 09966ae

File tree

8 files changed

+39
-354
lines changed

8 files changed

+39
-354
lines changed

src/Servers/HttpSys/src/NativeInterop/HttpApi.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.Diagnostics.CodeAnalysis;
55
using System.Runtime.InteropServices;
6-
using Microsoft.AspNetCore.HttpSys.Internal;
76
using Windows.Win32;
87
using Windows.Win32.Networking.HttpServer;
98

src/Shared/HttpSys/NativeInterop/SafeNativeOverlapped.cs renamed to src/Servers/HttpSys/src/NativeInterop/SafeNativeOverlapped.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
using System.Diagnostics;
55
using System.Runtime.InteropServices;
66

7-
namespace Microsoft.AspNetCore.HttpSys.Internal;
7+
namespace Microsoft.AspNetCore.Server.HttpSys;
88

99
internal sealed class SafeNativeOverlapped : SafeHandle
1010
{
1111
internal static readonly SafeNativeOverlapped Zero = new SafeNativeOverlapped();
1212
private readonly ThreadPoolBoundHandle? _boundHandle;
1313

14+
private static bool HasShutdownStarted => Environment.HasShutdownStarted
15+
|| AppDomain.CurrentDomain.IsFinalizingForUnload();
16+
1417
public SafeNativeOverlapped()
1518
: base(IntPtr.Zero, true)
1619
{
@@ -33,9 +36,9 @@ protected override bool ReleaseHandle()
3336
Debug.Assert(_boundHandle != null, "ReleaseHandle can't be called on SafeNativeOverlapped.Zero.");
3437

3538
IntPtr oldHandle = Interlocked.Exchange(ref handle, IntPtr.Zero);
36-
// Do not call free durring AppDomain shutdown, there may be an outstanding operation.
39+
// Do not call free during AppDomain shutdown, there may be an outstanding operation.
3740
// Overlapped will take care calling free when the native callback completes.
38-
if (oldHandle != IntPtr.Zero && !NclUtilities.HasShutdownStarted)
41+
if (oldHandle != IntPtr.Zero && !HasShutdownStarted)
3942
{
4043
unsafe
4144
{

src/Servers/HttpSys/src/RequestProcessing/ClientCertLoader.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System.Security;
88
using System.Security.Cryptography;
99
using System.Security.Cryptography.X509Certificates;
10-
using Microsoft.AspNetCore.HttpSys.Internal;
1110
using Windows.Win32.Networking.HttpServer;
1211

1312
namespace Microsoft.AspNetCore.Server.HttpSys;
@@ -16,7 +15,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys;
1615
// failures are handled internally and reported via ClientCertException or ClientCertError.
1716
internal sealed unsafe partial class ClientCertLoader : IAsyncResult, IDisposable
1817
{
19-
private const uint CertBoblSize = 1500;
18+
private const uint CertBlobSize = 1500;
2019
private static readonly IOCompletionCallback IOCallback = new IOCompletionCallback(WaitCallback);
2120

2221
private SafeNativeOverlapped? _overlapped;
@@ -37,7 +36,7 @@ internal ClientCertLoader(RequestContext requestContext, CancellationToken cance
3736
_tcs = new TaskCompletionSource<object?>();
3837
// we will use this overlapped structure to issue async IO to ul
3938
// the event handle will be put in by the BeginHttpApi2.ERROR_SUCCESS() method
40-
Reset(CertBoblSize);
39+
Reset(CertBlobSize);
4140

4241
if (cancellationToken.CanBeCanceled)
4342
{
@@ -151,7 +150,7 @@ private void Reset(uint size)
151150
// HTTP.SYS will not do this for you automatically
152151
internal Task LoadClientCertificateAsync()
153152
{
154-
var size = CertBoblSize;
153+
var size = CertBlobSize;
155154
bool retry;
156155
do
157156
{

src/Servers/HttpSys/src/RequestProcessing/RequestStreamAsyncResult.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.Diagnostics.CodeAnalysis;
55
using System.Runtime.InteropServices;
6-
using Microsoft.AspNetCore.HttpSys.Internal;
76

87
namespace Microsoft.AspNetCore.Server.HttpSys;
98

src/Servers/HttpSys/src/RequestProcessing/ResponseStreamAsyncResult.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.Diagnostics;
55
using System.Runtime.InteropServices;
6-
using Microsoft.AspNetCore.HttpSys.Internal;
76
using Windows.Win32.Foundation;
87
using Windows.Win32.Networking.HttpServer;
98

src/Shared/HttpSys/NativeInterop/NclUtilities.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)