System.Net.FtpWebRequest.SyncRequestCallback C# (CSharp) Метод

SyncRequestCallback() приватный Метод

private SyncRequestCallback ( object obj ) : void
obj object
Результат void
        private void SyncRequestCallback(object obj)
        {
            if (NetEventSource.IsEnabled) NetEventSource.Enter(this, obj);

            RequestStage stageMode = RequestStage.CheckForError;
            try
            {
                bool completedRequest = obj == null;
                Exception exception = obj as Exception;

                if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"exp:{exception} completedRequest:{completedRequest}");

                if (exception != null)
                {
                    SetException(exception);
                }
                else if (!completedRequest)
                {
                    throw new InternalException();
                }
                else
                {
                    FtpControlStream connection = _connection;

                    if (connection != null)
                    {
                        EnsureFtpWebResponse(null);

                        // This to update response status and exit message if any.
                        // Note that status 221 "Service closing control connection" is always suppressed.
                        _ftpWebResponse.UpdateStatus(connection.StatusCode, connection.StatusLine, connection.ExitMessage);
                    }

                    stageMode = RequestStage.ReleaseConnection;
                }
            }
            catch (Exception exception)
            {
                SetException(exception);
            }
            finally
            {
                FinishRequestStage(stageMode);
                if (NetEventSource.IsEnabled) NetEventSource.Exit(this);
                CheckError(); //will throw on error
            }
        }