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

◆ DrainAsync()

override async ValueTask< bool > System.Net.Http.HttpConnection.ContentLengthReadStream.DrainAsync ( int maxDrainBytes)
inlinevirtual

Reimplemented from System.Net.Http.HttpConnection.HttpContentReadStream.

Definition at line 666 of file HttpConnection.cs.

667 {
668 ReadFromConnectionBuffer(int.MaxValue);
670 {
671 Finish();
672 return true;
673 }
675 {
676 return false;
677 }
681 if (maxResponseDrainTime == TimeSpan.Zero)
682 {
683 return false;
684 }
686 {
687 cts = new CancellationTokenSource((int)maxResponseDrainTime.TotalMilliseconds);
688 ctr = cts.Token.Register(delegate(object s)
689 {
690 ((HttpConnection)s).Dispose();
691 }, _connection);
692 }
693 try
694 {
695 do
696 {
698 ReadFromConnectionBuffer(int.MaxValue);
699 }
700 while (_contentBytesRemaining != 0L);
701 ctr.Dispose();
702 CancellationHelper.ThrowIfCancellationRequested(ctr.Token);
703 Finish();
704 return true;
705 }
706 finally
707 {
708 ctr.Dispose();
709 cts?.Dispose();
710 }
711 }
ReadOnlyMemory< byte > ReadFromConnectionBuffer(int maxBytesToRead)
async ValueTask FillAsync(bool async)
HttpConnection(HttpConnectionPool pool, Socket socket, Stream stream, TransportContext transportContext)
readonly HttpConnectionPool _pool
static readonly TimeSpan InfiniteTimeSpan
Definition Timeout.cs:5

References System.Net.Http.HttpConnection.HttpConnection(), System.Net.Http.HttpContentStream._connection, System.Net.Http.HttpConnection.ContentLengthReadStream._contentBytesRemaining, System.Net.Http.HttpConnectionSettings._maxResponseDrainTime, System.Net.Http.HttpConnection._pool, System.Net.Http.HttpConnection.FillAsync(), System.Net.Http.HttpConnection.ContentLengthReadStream.Finish(), System.Threading.Timeout.InfiniteTimeSpan, System.L, System.Net.Http.HttpConnection.ContentLengthReadStream.ReadFromConnectionBuffer(), System.s, System.Net.Http.HttpConnectionPool.Settings, System.Net.Http.CancellationHelper.ThrowIfCancellationRequested(), and System.TimeSpan.Zero.