Exemplo n.º 1
0
        private void ProcessRequest()
#endif
        {
            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)
                {
                    if (!GetServicePoint().UsesProxy)
                    {
                        State = RequestState.Error;
                    }
                    SetCompleteWithError(e);
                }
            }
            else
            {
                if (InProgress())
                {
                    FtpStatus status = GetResponseStatus();

                    ftpResponse.UpdateStatus(status);

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

                asyncResult.SetCompleted(false, ftpResponse);
            }
        }