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

◆ BeginGetResponse()

override IAsyncResult System.Net.FtpWebRequest.BeginGetResponse ( AsyncCallback? callback,
object? state )
inlinevirtual

Reimplemented from System.Net.WebRequest.

Definition at line 585 of file FtpWebRequest.cs.

586 {
587 if (System.Net.NetEventSource.Log.IsEnabled())
588 {
589 System.Net.NetEventSource.Info(this, $"Method: {_methodInfo.Method}", "BeginGetResponse");
590 }
591 ContextAwareResult contextAwareResult;
592 try
593 {
594 if (_ftpWebResponse != null)
595 {
596 contextAwareResult = new ContextAwareResult(this, state, callback);
597 contextAwareResult.InvokeCallback(_ftpWebResponse);
598 return contextAwareResult;
599 }
601 {
603 }
604 _getResponseStarted = true;
605 CheckError();
606 RequestStage requestStage = FinishRequestStage(RequestStage.RequestStarted);
607 contextAwareResult = (ContextAwareResult)(_readAsyncResult = new ContextAwareResult(captureIdentity: true, forceCaptureContext: true, this, state, callback));
608 if (requestStage >= RequestStage.RequestStarted)
609 {
610 contextAwareResult.StartPostingAsyncOp();
611 contextAwareResult.FinishPostingAsyncOp();
612 if (requestStage >= RequestStage.ReadReady)
613 {
614 contextAwareResult = null;
615 }
616 else
617 {
618 lock (_syncObject)
619 {
620 if (_requestStage >= RequestStage.ReadReady)
621 {
622 contextAwareResult = null;
623 }
624 }
625 }
626 if (contextAwareResult == null)
627 {
628 contextAwareResult = (ContextAwareResult)_readAsyncResult;
629 if (!contextAwareResult.InternalPeekCompleted)
630 {
631 contextAwareResult.InvokeCallback();
632 }
633 }
634 }
635 else
636 {
637 lock (contextAwareResult.StartPostingAsyncOp())
638 {
639 SubmitRequest(isAsync: true);
640 contextAwareResult.FinishPostingAsyncOp();
641 }
642 FinishRequestStage(RequestStage.CheckForError);
643 }
644 }
645 catch (Exception message)
646 {
647 if (System.Net.NetEventSource.Log.IsEnabled())
648 {
649 System.Net.NetEventSource.Error(this, message, "BeginGetResponse");
650 }
651 throw;
652 }
653 return contextAwareResult;
654 }
LazyAsyncResult _readAsyncResult
FtpWebResponse _ftpWebResponse
void SubmitRequest(bool isAsync)
RequestStage FinishRequestStage(RequestStage stage)
void InvokeCallback(object result)
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_repcall
Definition SR.cs:38
Definition SR.cs:7

References System.Net.FtpWebRequest._ftpWebResponse, System.Net.FtpWebRequest._getResponseStarted, System.Net.FtpWebRequest._readAsyncResult, System.Net.FtpWebRequest._requestStage, System.Net.FtpWebRequest._syncObject, System.Net.FtpWebRequest.CheckError(), System.Net.NetEventSource.Error(), System.Net.ContextAwareResult.FinishPostingAsyncOp(), System.Net.FtpWebRequest.FinishRequestStage(), System.Net.NetEventSource.Info(), System.Net.LazyAsyncResult.InternalPeekCompleted, System.Net.LazyAsyncResult.InvokeCallback(), System.Net.NetEventSource.Log, System.SR.net_repcall, System.Net.ContextAwareResult.StartPostingAsyncOp(), System.state, and System.Net.FtpWebRequest.SubmitRequest().