Exemplo n.º 1
0
        internal void Execute(int timeout)
        {
            bool ccLocked = false;

            try
            {
                ccLocked = _cc.Lock(Timeout.Infinite);
                if (null != _client.CurrentDTP)
                {
                    //----------------------------------------
                    //In case when we have active DTP we delegate
                    //handling responses to it and here only send
                    //abort command
                    _cc.SendCommand(timeout, "ABOR");

                    //----------------------------------------
                    //Notify DTP that it should abort data
                    //connection and handle abort command
                    //
                    _client.CurrentDTP.Abort();
                }
                else
                {
                    //----------------------------------------
                    //In case there is no DTP, but user wants
                    //issue abort command we should dealing with
                    //responses here ...
                    FtpResponse response = _cc.SendCommandEx(timeout, "ABOR");
                    FtpClient.CheckCompletionResponse(response);
                }
            }
            finally
            {
                if (true == ccLocked)
                {
                    _cc.Unlock();
                }
            }
        }
Exemplo n.º 2
0
        internal void Execute(int timeout)
        {
            bool ccLocked = false;

            try
            {
                ccLocked = _cc.Lock(Timeout.Infinite);
                if (null != _client.CurrentDTP)
                {
                    //----------------------------------------
                    //In case when we have active DTP we delegate
                    //handling responses to it and here only send
                    //quit command
                    _cc.SendCommand(timeout, "QUIT");

                    //----------------------------------------
                    //Notify DTP that it should handle quit
                    //issue
                    _client.CurrentDTP.Quit();
                }
                else
                {
                    //----------------------------------------
                    //In case there is no DTP, we should
                    //dealing with responses here ...
                    FtpResponse response = _cc.SendCommandEx(timeout, "QUIT");
                    FtpClient.CheckCompletionResponse(response);
                }
            }
            finally
            {
                if (true == ccLocked)
                {
                    _cc.Unlock();
                }
            }
        }