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

◆ TimedSubmitRequestHelper()

Stream System.Net.FtpWebRequest.TimedSubmitRequestHelper ( bool isAsync)
inlineprivate

Definition at line 931 of file FtpWebRequest.cs.

932 {
933 if (isAsync)
934 {
935 if (_requestCompleteAsyncResult == null)
936 {
937 _requestCompleteAsyncResult = new LazyAsyncResult(null, null, null);
938 }
939 return _connection.SubmitRequest(this, isAsync: true, readInitalResponseOnConnect: true);
940 }
941 Stream stream = null;
942 bool flag = false;
943 TimerThread.Timer timer = TimerQueue.CreateTimer(_timerCallback, null);
944 try
945 {
946 stream = _connection.SubmitRequest(this, isAsync: false, readInitalResponseOnConnect: true);
947 }
948 catch (Exception ex)
949 {
950 if ((!(ex is SocketException) && !(ex is ObjectDisposedException)) || !timer.HasExpired)
951 {
952 timer.Cancel();
953 throw;
954 }
955 flag = true;
956 }
957 if (flag || !timer.Cancel())
958 {
959 _timedOut = true;
960 throw ExceptionHelper.TimeoutException;
961 }
962 if (stream != null)
963 {
964 lock (_syncObject)
965 {
966 if (_aborted)
967 {
968 ((ICloseEx)stream).CloseEx(CloseExState.Abort | CloseExState.Silent);
969 CheckError();
970 throw new System.Net.InternalException();
971 }
972 _stream = stream;
973 }
974 }
975 return stream;
976 }
Stream SubmitRequest(WebRequest request, bool isAsync, bool readInitalResponseOnConnect)
readonly TimerThread.Callback _timerCallback
FtpControlStream _connection
LazyAsyncResult _requestCompleteAsyncResult

References System.Net.TimerThread.Timer.Cancel(), System.Net.TimerThread.Timer.HasExpired, System.stream, System.Net.CommandStream.SubmitRequest(), and System.Net.ExceptionHelper.TimeoutException.

Referenced by System.Net.FtpWebRequest.SubmitRequest().