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

◆ EndRead()

override int System.Net.HttpRequestStream.EndRead ( IAsyncResult asyncResult)
inlinevirtual

Reimplemented from System.IO.Stream.

Definition at line 382 of file HttpRequestStream.cs.

383 {
384 if (System.Net.NetEventSource.Log.IsEnabled())
385 {
386 System.Net.NetEventSource.Info(this, $"asyncResult: {asyncResult}", "EndRead");
387 }
388 if (asyncResult == null)
389 {
390 throw new ArgumentNullException("asyncResult");
391 }
392 if (!(asyncResult is HttpRequestStreamAsyncResult httpRequestStreamAsyncResult) || httpRequestStreamAsyncResult.AsyncObject != this)
393 {
394 throw new ArgumentException(System.SR.net_io_invalidasyncresult, "asyncResult");
395 }
396 if (httpRequestStreamAsyncResult.EndCalled)
397 {
399 }
400 httpRequestStreamAsyncResult.EndCalled = true;
401 object obj = httpRequestStreamAsyncResult.InternalWaitForCompletion();
402 if (obj is Exception ex)
403 {
404 if (System.Net.NetEventSource.Log.IsEnabled())
405 {
406 System.Net.NetEventSource.Info(this, "Rethrowing exception:" + ex, "EndRead");
407 System.Net.NetEventSource.Error(this, ex.ToString(), "EndRead");
408 }
410 }
411 uint num = (uint)obj;
412 UpdateAfterRead((uint)httpRequestStreamAsyncResult.ErrorCode, num);
413 if (System.Net.NetEventSource.Log.IsEnabled())
414 {
415 System.Net.NetEventSource.Info(this, $"returnValue:{obj}", "EndRead");
416 }
417 return (int)(num + httpRequestStreamAsyncResult._dataAlreadyRead);
418 }
void UpdateAfterRead(uint statusCode, uint dataRead)
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static string net_io_invalidendcall
Definition SR.cs:22
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_io_invalidasyncresult
Definition SR.cs:20
Definition SR.cs:7

References System.asyncResult, System.Net.NetEventSource.Error(), System.SR.Format(), System.Net.NetEventSource.Info(), System.Net.NetEventSource.Log, System.SR.net_io_invalidasyncresult, System.SR.net_io_invalidendcall, System.obj, System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(), and System.Net.HttpRequestStream.UpdateAfterRead().

Referenced by System.Net.WebSockets.WebSocketHttpListenerDuplexStream.EndRead().