Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HttpListenerSession.cs
Go to the documentation of this file.
3
4namespace System.Net;
5
6internal sealed class HttpListenerSession
7{
8 public readonly HttpListener Listener;
9
11
13
15 {
16 get
17 {
18 if (_requestQueueBoundHandle == null)
19 {
20 lock (this)
21 {
22 if (_requestQueueBoundHandle == null)
23 {
25 if (System.Net.NetEventSource.Log.IsEnabled())
26 {
27 System.Net.NetEventSource.Info($"ThreadPoolBoundHandle.BindHandle({RequestQueueHandle}) -> {_requestQueueBoundHandle}", null, "RequestQueueBoundHandle");
28 }
29 }
30 }
31 }
33 }
34 }
35
36 public unsafe HttpListenerSession(HttpListener listener)
37 {
38 Listener = listener;
39 HttpRequestQueueV2Handle pReqQueueHandle;
40 uint num = global::Interop.HttpApi.HttpCreateRequestQueue(global::Interop.HttpApi.s_version, null, null, 0u, out pReqQueueHandle);
41 if (num != 0)
42 {
43 throw new HttpListenerException((int)num);
44 }
45 if (HttpListener.SkipIOCPCallbackOnSuccess && !global::Interop.Kernel32.SetFileCompletionNotificationModes(pReqQueueHandle, global::Interop.Kernel32.FileCompletionNotificationModes.SkipCompletionPortOnSuccess | global::Interop.Kernel32.FileCompletionNotificationModes.SkipSetEventOnHandle))
46 {
48 }
49 RequestQueueHandle = pReqQueueHandle;
50 }
51
52 public unsafe void CloseRequestQueueHandle()
53 {
54 lock (this)
55 {
57 {
58 if (System.Net.NetEventSource.Log.IsEnabled())
59 {
60 System.Net.NetEventSource.Info($"Dispose ThreadPoolBoundHandle: {_requestQueueBoundHandle}", null, "CloseRequestQueueHandle");
61 }
64 try
65 {
66 global::Interop.Kernel32.CancelIoEx(RequestQueueHandle, null);
67 return;
68 }
70 {
71 return;
72 }
73 }
74 }
75 }
76}
ThreadPoolBoundHandle _requestQueueBoundHandle
ThreadPoolBoundHandle RequestQueueBoundHandle
unsafe HttpListenerSession(HttpListener listener)
static readonly bool SkipIOCPCallbackOnSuccess
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static ThreadPoolBoundHandle BindHandle(SafeHandle handle)