Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AsyncRequestContext.cs
Go to the documentation of this file.
2
3namespace System.Net;
4
6{
8
10
11 private readonly ListenerAsyncResult _result;
12
14
16 {
17 _result = result;
18 BaseConstruction(Allocate(boundHandle, 0u));
19 }
20
21 private unsafe global::Interop.HttpApi.HTTP_REQUEST* Allocate(ThreadPoolBoundHandle boundHandle, uint size)
22 {
23 uint num = ((size != 0) ? size : ((base.RequestBuffer == IntPtr.Zero) ? 4096u : base.Size));
24 if (_nativeOverlapped != null)
25 {
26 NativeOverlapped* nativeOverlapped = _nativeOverlapped;
27 _nativeOverlapped = null;
28 _boundHandle.FreeNativeOverlapped(nativeOverlapped);
29 }
30 SetBuffer(checked((int)num));
31 _boundHandle = boundHandle;
33 return (global::Interop.HttpApi.HTTP_REQUEST*)base.RequestBuffer.ToPointer();
34 }
35
36 internal unsafe void Reset(ThreadPoolBoundHandle boundHandle, ulong requestId, uint size)
37 {
38 SetBlob(Allocate(boundHandle, size));
39 base.RequestBlob->RequestId = requestId;
40 }
41
42 protected unsafe override void OnReleasePins()
43 {
44 if (_nativeOverlapped != null)
45 {
46 NativeOverlapped* nativeOverlapped = _nativeOverlapped;
47 _nativeOverlapped = null;
48 _boundHandle.FreeNativeOverlapped(nativeOverlapped);
49 }
50 }
51
52 protected unsafe override void Dispose(bool disposing)
53 {
54 if (_nativeOverlapped != null && (!Environment.HasShutdownStarted || disposing))
55 {
57 }
58 base.Dispose(disposing);
59 }
60}
static bool HasShutdownStarted
readonly ListenerAsyncResult _result
ThreadPoolBoundHandle _boundHandle
unsafe override void Dispose(bool disposing)
unsafe override void OnReleasePins()
unsafe AsyncRequestContext(ThreadPoolBoundHandle boundHandle, ListenerAsyncResult result)
unsafe global::Interop.HttpApi.HTTP_REQUEST * Allocate(ThreadPoolBoundHandle boundHandle, uint size)
unsafe NativeOverlapped * _nativeOverlapped
unsafe void Reset(ThreadPoolBoundHandle boundHandle, ulong requestId, uint size)
static IOCompletionCallback IOCallback
unsafe void SetBuffer(int size)
unsafe void BaseConstruction(global::Interop.HttpApi.HTTP_REQUEST *requestBlob)
unsafe void SetBlob(global::Interop.HttpApi.HTTP_REQUEST *requestBlob)
unsafe void FreeNativeOverlapped(NativeOverlapped *overlapped)
unsafe NativeOverlapped * AllocateNativeOverlapped(IOCompletionCallback callback, object? state, object? pinData)
static readonly IntPtr Zero
Definition IntPtr.cs:18