Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ HttpResponseStreamAsyncResult() [2/2]

unsafe System.Net.HttpResponseStreamAsyncResult.HttpResponseStreamAsyncResult ( object asyncObject,
object userState,
AsyncCallback callback,
byte[] buffer,
int offset,
int size,
bool chunked,
bool sentHeaders,
ThreadPoolBoundHandle boundHandle )
inlinepackage

Definition at line 81 of file HttpResponseStreamAsyncResult.cs.

82 : base(asyncObject, userState, callback)
83 {
84 _boundHandle = boundHandle;
85 _sentHeaders = sentHeaders;
86 if (size == 0)
87 {
88 _dataChunks = null;
89 _pOverlapped = boundHandle.AllocateNativeOverlapped(s_IOCallback, this, null);
90 return;
91 }
92 _dataChunks = new global::Interop.HttpApi.HTTP_DATA_CHUNK[(!chunked) ? 1 : 3];
93 if (System.Net.NetEventSource.Log.IsEnabled())
94 {
95 System.Net.NetEventSource.Info(this, "m_pOverlapped:0x" + ((IntPtr)_pOverlapped).ToString("x8"), ".ctor");
96 }
97 object[] array = new object[1 + _dataChunks.Length];
99 int offset2 = 0;
100 byte[] array2 = null;
101 if (chunked)
102 {
103 array2 = GetChunkHeader(size, out offset2);
104 _dataChunks[0] = default(global::Interop.HttpApi.HTTP_DATA_CHUNK);
105 _dataChunks[0].DataChunkType = global::Interop.HttpApi.HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromMemory;
106 _dataChunks[0].BufferLength = (uint)(array2.Length - offset2);
107 array[0] = array2;
108 _dataChunks[1] = default(global::Interop.HttpApi.HTTP_DATA_CHUNK);
109 _dataChunks[1].DataChunkType = global::Interop.HttpApi.HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromMemory;
110 _dataChunks[1].BufferLength = (uint)size;
111 array[1] = buffer;
112 _dataChunks[2] = default(global::Interop.HttpApi.HTTP_DATA_CHUNK);
113 _dataChunks[2].DataChunkType = global::Interop.HttpApi.HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromMemory;
114 _dataChunks[2].BufferLength = (uint)s_CRLFArray.Length;
115 array[2] = s_CRLFArray;
116 }
117 else
118 {
119 _dataChunks[0] = default(global::Interop.HttpApi.HTTP_DATA_CHUNK);
120 _dataChunks[0].DataChunkType = global::Interop.HttpApi.HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromMemory;
121 _dataChunks[0].BufferLength = (uint)size;
122 array[0] = buffer;
123 }
125 if (chunked)
126 {
127 _dataChunks[0].pBuffer = (byte*)(void*)Marshal.UnsafeAddrOfPinnedArrayElement(array2, offset2);
129 _dataChunks[2].pBuffer = (byte*)(void*)Marshal.UnsafeAddrOfPinnedArrayElement(s_CRLFArray, 0);
130 }
131 else
132 {
134 }
135 }
static unsafe readonly IOCompletionCallback s_IOCallback
readonly global::Interop.HttpApi.HTTP_DATA_CHUNK[] _dataChunks
static byte[] GetChunkHeader(int size, out int offset)
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static unsafe IntPtr UnsafeAddrOfPinnedArrayElement(Array arr, int index)
Definition Marshal.cs:775
unsafe NativeOverlapped * AllocateNativeOverlapped(IOCompletionCallback callback, object? state, object? pinData)

References System.Net.HttpResponseStreamAsyncResult._boundHandle, System.Net.HttpResponseStreamAsyncResult._dataChunks, System.Net.HttpResponseStreamAsyncResult._pOverlapped, System.Net.HttpResponseStreamAsyncResult._sentHeaders, System.Threading.ThreadPoolBoundHandle.AllocateNativeOverlapped(), System.array, System.buffer, System.Net.HttpResponseStreamAsyncResult.GetChunkHeader(), System.Net.NetEventSource.Info(), System.Net.NetEventSource.Log, System.offset, System.Net.HttpResponseStreamAsyncResult.s_CRLFArray, System.Net.HttpResponseStreamAsyncResult.s_IOCallback, System.ToString, and System.Runtime.InteropServices.Marshal.UnsafeAddrOfPinnedArrayElement().