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

◆ SubmitRequest()

void System.Net.FtpWebRequest.SubmitRequest ( bool isAsync)
inlineprivate

Definition at line 815 of file FtpWebRequest.cs.

816 {
817 try
818 {
819 _async = isAsync;
820 while (true)
821 {
822 FtpControlStream ftpControlStream = _connection;
823 if (ftpControlStream == null)
824 {
825 if (isAsync)
826 {
828 return;
829 }
830 ftpControlStream = (_connection = CreateConnection());
831 }
832 if (!isAsync && Timeout != -1)
833 {
834 _remainingTimeout = Timeout - (int)(DateTime.UtcNow - _startTime).TotalMilliseconds;
835 if (_remainingTimeout <= 0)
836 {
837 break;
838 }
839 }
840 if (System.Net.NetEventSource.Log.IsEnabled())
841 {
842 System.Net.NetEventSource.Info(this, "Request being submitted", "SubmitRequest");
843 }
844 ftpControlStream.SetSocketTimeoutOption(RemainingTimeout);
845 try
846 {
848 return;
849 }
850 catch (Exception e)
851 {
852 if (AttemptedRecovery(e))
853 {
854 if (!isAsync && Timeout != -1)
855 {
856 _remainingTimeout = Timeout - (int)(DateTime.UtcNow - _startTime).TotalMilliseconds;
857 if (_remainingTimeout <= 0)
858 {
859 throw;
860 }
861 }
862 continue;
863 }
864 throw;
865 }
866 }
867 throw ExceptionHelper.TimeoutException;
868 }
869 catch (WebException ex)
870 {
871 if (ex.InnerException is IOException { InnerException: SocketException { SocketErrorCode: SocketError.TimedOut } })
872 {
874 }
875 else
876 {
877 SetException(ex);
878 }
879 }
880 catch (Exception exception)
881 {
883 }
884 }
FtpControlStream CreateConnection()
async void CreateConnectionAsync()
bool AttemptedRecovery(Exception e)
FtpControlStream _connection
Stream TimedSubmitRequestHelper(bool isAsync)
void SetException(Exception exception)
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static string net_timeout
Definition SR.cs:66
Definition SR.cs:7

References System.Net.FtpWebRequest._async, System.Net.FtpWebRequest._connection, System.Net.FtpWebRequest._remainingTimeout, System.Net.FtpWebRequest._startTime, System.Net.FtpWebRequest.AttemptedRecovery(), System.Net.FtpWebRequest.CreateConnection(), System.Net.FtpWebRequest.CreateConnectionAsync(), System.Net.NetEventSource.Info(), System.Exception.InnerException, System.Net.NetEventSource.Log, System.SR.net_timeout, System.Net.FtpWebRequest.RemainingTimeout, System.Runtime.ExceptionServices.ExceptionDispatchInfo.SetCurrentStackTrace(), System.Net.FtpWebRequest.SetException(), System.Net.NetworkStreamWrapper.SetSocketTimeoutOption(), System.stream, System.Net.FtpWebRequest.TimedSubmitRequestHelper(), System.Net.ExceptionHelper.TimeoutException, and System.DateTime.UtcNow.

Referenced by System.Net.FtpWebRequest.BeginGetRequestStream(), System.Net.FtpWebRequest.BeginGetResponse(), System.Net.FtpWebRequest.GetRequestStream(), and System.Net.FtpWebRequest.GetResponse().