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

◆ ReadBufferedAsyncCore()

async ValueTask< int > System.Net.Http.HttpConnection.ReadBufferedAsyncCore ( Memory< byte > destination)
inlineprivate

Definition at line 2407 of file HttpConnection.cs.

2408 {
2409 int num = _readLength - _readOffset;
2410 if (num > 0)
2411 {
2412 if (destination.Length <= num)
2413 {
2415 return destination.Length;
2416 }
2417 ReadFromBuffer(destination.Span.Slice(0, num));
2418 return num;
2419 }
2420 _readOffset = (_readLength = 0);
2421 int num2 = await _stream.ReadAsync(_readBuffer.AsMemory()).ConfigureAwait(continueOnCapturedContext: false);
2422 if (System.Net.NetEventSource.Log.IsEnabled())
2423 {
2424 Trace($"Received {num2} bytes.", "ReadBufferedAsyncCore");
2425 }
2426 _readLength = num2;
2427 int num3 = Math.Min(num2, destination.Length);
2428 _readBuffer.AsSpan(0, num3).CopyTo(destination.Span);
2429 _readOffset = num3;
2430 return num3;
2431 }
Task< int > ReadAsync(byte[] buffer, int offset, int count)
Definition Stream.cs:762
void ReadFromBuffer(Span< byte > buffer)
override void Trace(string message, [CallerMemberName] string memberName=null)
static readonly System.Net.NetEventSource Log

References System.Net.Http.HttpConnection._readBuffer, System.Net.Http.HttpConnection._readLength, System.Net.Http.HttpConnection._readOffset, System.Net.Http.HttpConnection._stream, System.destination, System.Net.NetEventSource.Log, System.Math.Min(), System.IO.Stream.ReadAsync(), System.Net.Http.HttpConnection.ReadFromBuffer(), and System.Net.Http.HttpConnection.Trace().

Referenced by System.Net.Http.HttpConnection.ReadBufferedAsync().