Exemple #1
0
        /// <summary>
        /// Event handler for close stream.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">The event args.</param>
        private void OnCloseStream(object sender, RSTEventArgs e)
        {
            SMStream stream = sender as SMStream;

            this.streams.Remove(stream);
            this.closedStreams.Add(stream);

            if (this.OnStreamClosed != null)
            {
                this.OnStreamClosed(this, e);
            }
        }
        /// <summary>
        /// Event handler for close stream.
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">Event data</param>
        private static void OnStreamClosed(object sender, RSTEventArgs e)
        {
            string filename = e.Stream.Headers[SMHeaders.Path];
            if (filename == null)
            {
                filename = string.Empty;
            }

            SMLogger.LogConsole("Stream is closed: id=" + e.Stream.StreamId);
            lock (exclusiveLock)
            {
                currentStreams.CloseStream(filename);
            }
        }
        /// <summary>
        /// Event handler for stream reset.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.ServiceModel.SMProtocol.RSTEventArgs"/> instance containing the event data.</param>
        private static void OnRSTReceived(object sender, RSTEventArgs e)
        {
            string filename = e.Stream.Headers[SMHeaders.Path];
            if (filename == null)
            {
                filename = string.Empty;
            }

            lock (exclusiveLock)
            {
                currentStreams.CloseStream(filename);
            }

            if (rootFileName == filename)
            {
                // signal main thread to proceed
                rootFileName = string.Empty;
                rootDownloadEvent.Set();
            }

            SMLogger.LogError("Stream reset (File not found): stream id=" + e.Stream.StreamId + " filename=" + filename);
        }
        /// <summary>
        /// Event handler for close stream.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">The event args.</param>
        private void OnCloseStream(object sender, RSTEventArgs e)
        {
            SMStream stream = sender as SMStream;
            this.streams.Remove(stream);
            this.closedStreams.Add(stream);

            if (this.OnStreamClosed != null)
            {
                this.OnStreamClosed(this, e);
            }
        }
        /// <summary>
        /// Event handler for stream reset.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.ServiceModel.SMProtocol.RSTEventArgs"/> instance containing the event data.</param>
        private static void OnRSTReceived(object sender, RSTEventArgs e)
        {
            string filename = e.Stream.Headers[SMHeaders.Path];
            if (filename == null)
            {
                filename = string.Empty;
            }

            SMLogger.LogError("Stream reset (File not found): stream id=" + e.Stream.StreamId + " filename=" + filename);
        }