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(); }
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; }
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(); }
private void Channel_Closed(object sender, ChannelEventArgs e) { // TODO: Do we need to call dispose here ?? Dispose(); }
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; }
private void Channel_Closed(object sender, ChannelEventArgs e) { var channelClosedWaitHandle = _channelClosedWaitHandle; if (channelClosedWaitHandle != null) channelClosedWaitHandle.Set(); }
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; }
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(); }