Exemplo n.º 1
0
        void ProcessRequest()
        {
            if (State == RequestState.Scheduled)
            {
                ftpResponse = new FtpWebResponse(this, requestUri, method, keepAlive);

                try {
                    ProcessMethod();
                    //State = RequestState.Finished;
                    //finalResponse = ftpResponse;
                    asyncResult.SetCompleted(false, ftpResponse);
                }
                catch (Exception e) {
                    State = RequestState.Error;
                    SetCompleteWithError(e);
                }
            }
            else
            {
                if (InProgress())
                {
                    FtpStatus status = GetResponseStatus();

                    ftpResponse.UpdateStatus(status);

                    if (ftpResponse.IsFinal())
                    {
                        State = RequestState.Finished;
                    }
                }

                asyncResult.SetCompleted(false, ftpResponse);
            }
        }