/// <summary> /// Closes the connection /// </summary> public override void Close() { if (!IsDisposed) { try { Send(EndStream); } // TODO: empty try-catch bad, martial arts good // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { } finally { if (tlsProceedEvent != null) { tlsProceedEvent.Set(); tlsProceedEvent = null; } if (networkStream != null) { networkStream.Dispose(); networkStream = null; } if (socket != null) { socket.Close(); socket = null; } if (inputBuffer != null) { inputBuffer.Dispose(); inputBuffer = null; } if (parser != null) { parser.Dispose(); parser = null; } } base.Close(); } }
/// <summary> /// Closes the connection /// </summary> public override void Close() { if (!IsDisposed) { try { Send(EndStream); } // TODO: empty try-catch bad, martial arts good // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { } finally { if (tlsProceedEvent != null) { tlsProceedEvent.Set(); tlsProceedEvent = null; } if (networkStream != null) { networkStream.Dispose(); networkStream = null; } if (socket != null) { socket.Close(); socket = null; } if (inputBuffer != null) { inputBuffer.Dispose(); inputBuffer = null; } if (parser != null) { parser.Dispose(); parser = null; } } base.Close(); } }
/// <summary> /// Initializes the connection instance /// </summary> private void Initialize() { inputBuffer = new XmppMemoryStream(); parser = new XmppStreamParser(inputBuffer); tlsProceedEvent = new AutoResetEvent(false); }
/// <summary> /// Initializes the connection instance /// </summary> private void Initialize() { inputBuffer = new XmppMemoryStream(); parser = new XmppStreamParser(inputBuffer); tlsProceedEvent = new AutoResetEvent(false); }
/// <summary> /// Closes the connection /// </summary> public override void Close() { if (!this.IsDisposed) { try { this.Send(EndStream); } catch { } finally { if (this.tlsProceedEvent != null) { this.tlsProceedEvent.Set(); this.tlsProceedEvent = null; } if (this.networkStream != null) { this.networkStream.Dispose(); this.networkStream = null; } if (this.socket != null) { this.socket.Close(); this.socket = null; } if (this.inputBuffer != null) { this.inputBuffer.Dispose(); this.inputBuffer = null; } if (this.parser != null) { this.parser.Dispose(); this.parser = null; } } base.Close(); } }