Exemple #1
0
        internal void BeginDataTransfer(FtpDataStream stream)
        {
            lock (this)
            {
                if (m_dataStream != null)
                    throw new FtpDataTransferException();

                m_dataStream = stream;
            }
        }
Exemple #2
0
        internal void EndDataTransfer()
        {
            lock (this)
            {
                if (m_dataStream == null)
                    throw new InvalidOperationException();

                m_dataStream = null;
            }
        }
Exemple #3
0
        /// <summary>
        /// Releases the unmanaged resources used by the <see cref="FtpSessionConnected"/> object and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!m_disposed)
            {
                try
                {
                    // This will be done regardless of whether the object is finalized or disposed.

                    if (disposing)
                    {
                        m_host = null;
                        m_root = null;
                        m_current = null;

                        if (m_ctrlChannel != null)
                            m_ctrlChannel.Close();

                        m_ctrlChannel = null;

                        if (m_dataStream != null)
                            m_dataStream.Dispose();

                        m_dataStream = null;
                    }
                }
                finally
                {
                    m_disposed = true;  // Prevent duplicate dispose.
                }
            }
        }