Base class for all channel related events.
Inheritance: System.EventArgs
コード例 #1
0
        private void Channel_Closed(object sender, Common.ChannelEventArgs e)
        {
            if (this.OutputStream != null)
            {
                this.OutputStream.Flush();
            }

            if (this.ExtendedOutputStream != null)
            {
                this.ExtendedOutputStream.Flush();
            }

            this._asyncResult.IsCompleted = true;

            if (this._callback != null)
            {
                //  Execute callback on different thread
                this.ExecuteThread(() => { this._callback(this._asyncResult); });
            }
            ((EventWaitHandle)this._asyncResult.AsyncWaitHandle).Set();
        }
コード例 #2
0
ファイル: Shell.cs プロジェクト: hafsjold/snvrepos
        private void Channel_Closed(object sender, Common.ChannelEventArgs e)
        {
            if (this.Stopping != null)
            {
                //  Handle event on different thread
                this.ExecuteThread(() => { this.Stopping(this, new EventArgs()); });
            }

            if (this._channel.IsOpen)
            {
                this._channel.SendEof();

                this._channel.Close();
            }

            this._channelClosedWaitHandle.Set();

            this._input.Dispose();
            this._input = null;

            this._dataReaderTaskCompleted.WaitOne(this._session.ConnectionInfo.Timeout);
            this._dataReaderTaskCompleted.Dispose();
            this._dataReaderTaskCompleted = null;

            this._channel.DataReceived         -= Channel_DataReceived;
            this._channel.ExtendedDataReceived -= Channel_ExtendedDataReceived;
            this._channel.Closed       -= Channel_Closed;
            this._session.Disconnected -= Session_Disconnected;
            this._session.ErrorOccured -= Session_ErrorOccured;

            if (this.Stopped != null)
            {
                //  Handle event on different thread
                this.ExecuteThread(() => { this.Stopped(this, new EventArgs()); });
            }

            this._channel = null;
        }
コード例 #3
0
ファイル: SshCommand.cs プロジェクト: npcook/terminal
        private void Channel_Closed(object sender, ChannelEventArgs e)
        {
            if (this.OutputStream != null)
            {
                this.OutputStream.Flush();
            }

            if (this.ExtendedOutputStream != null)
            {
                this.ExtendedOutputStream.Flush();
            }

            this._asyncResult.IsCompleted = true;

            if (this._callback != null)
            {
                //  Execute callback on different thread
                this.ExecuteThread(() => this._callback(this._asyncResult));
            }
            ((EventWaitHandle)this._asyncResult.AsyncWaitHandle).Set();
        }
コード例 #4
0
ファイル: ShellStream.cs プロジェクト: REALTOBIZ/SSH.NET
 private void Channel_Closed(object sender, ChannelEventArgs e)
 {
     //  TODO:   Do we need to call dispose here ??
     Dispose();
 }
コード例 #5
0
ファイル: Shell.cs プロジェクト: npcook/terminal
        private void Channel_Closed(object sender, ChannelEventArgs e)
        {
            if (this.Stopping != null)
            {
                //  Handle event on different thread
                this.ExecuteThread(() => this.Stopping(this, new EventArgs()));
            }

            if (this._channel.IsOpen)
            {
                this._channel.Close();
            }

            this._channelClosedWaitHandle.Set();

            this._input.Dispose();
            this._input = null;

            this._dataReaderTaskCompleted.WaitOne(this._session.ConnectionInfo.Timeout);
            this._dataReaderTaskCompleted.Dispose();
            this._dataReaderTaskCompleted = null;

            this._channel.DataReceived -= Channel_DataReceived;
            this._channel.ExtendedDataReceived -= Channel_ExtendedDataReceived;
            this._channel.Closed -= Channel_Closed;
            this._session.Disconnected -= Session_Disconnected;
            this._session.ErrorOccured -= Session_ErrorOccured;

            if (this.Stopped != null)
            {
                //  Handle event on different thread
                this.ExecuteThread(() => this.Stopped(this, new EventArgs()));
            }

            this._channel = null;
        }
コード例 #6
0
 private void Channel_Closed(object sender, ChannelEventArgs e)
 {
     var channelClosedWaitHandle = _channelClosedWaitHandle;
     if (channelClosedWaitHandle != null)
         channelClosedWaitHandle.Set();
 }
コード例 #7
0
ファイル: Shell.cs プロジェクト: sshnet/SSH.NET
        private void Channel_Closed(object sender, ChannelEventArgs e)
        {
            if (Stopping != null)
            {
                //  Handle event on different thread
                ThreadAbstraction.ExecuteThread(() => Stopping(this, new EventArgs()));
            }

            _channel.Dispose();
            _channelClosedWaitHandle.Set();

            _input.Dispose();
            _input = null;

            _dataReaderTaskCompleted.WaitOne(_session.ConnectionInfo.Timeout);
            _dataReaderTaskCompleted.Dispose();
            _dataReaderTaskCompleted = null;

            _channel.DataReceived -= Channel_DataReceived;
            _channel.ExtendedDataReceived -= Channel_ExtendedDataReceived;
            _channel.Closed -= Channel_Closed;

            UnsubscribeFromSessionEvents(_session);

            if (Stopped != null)
            {
                //  Handle event on different thread
                ThreadAbstraction.ExecuteThread(() => Stopped(this, new EventArgs()));
            }

            _channel = null;
        }
コード例 #8
0
ファイル: SshCommand.cs プロジェクト: sshnet/SSH.NET
        private void Channel_Closed(object sender, ChannelEventArgs e)
        {
            var outputStream = OutputStream;
            if (outputStream != null)
            {
                outputStream.Flush();
            }

            var extendedOutputStream = ExtendedOutputStream;
            if (extendedOutputStream != null)
            {
                extendedOutputStream.Flush();
            }

            _asyncResult.IsCompleted = true;

            if (_callback != null)
            {
                //  Execute callback on different thread
                ThreadAbstraction.ExecuteThread(() => _callback(_asyncResult));
            }
            ((EventWaitHandle) _asyncResult.AsyncWaitHandle).Set();
        }