protected virtual void Dispose(bool disposing) { if (disposing && (_connection != null)) { #nullable disable _isPubSubMode = false; _pubsubSender?.TryComplete(); _pubsubSender = null; _connection.Dispose(); _connection = null; #nullable enable }
internal HostConnection RemoveConnection(ConnectionBase conn, HTTPConnectionStates setState) { conn.State = setState; conn.Dispose(); bool found = this.Connections.Remove(conn); if (!found) HTTPManager.Logger.Warning(typeof(HostConnection).Name, string.Format("RemoveConnection - Couldn't find connection! key: {0}", conn.ServerAddress), this.Context, conn.Context); return this; }
internal HostConnection RemoveConnection(ConnectionBase conn, HTTPConnectionStates setState) { conn.State = setState; conn.Dispose(); bool found = this.Connections.Remove(conn); if (!found) { HTTPManager.Logger.Warning(typeof(HostConnection).Name, "RemoveConnection - Couldn't find connection! key: " + conn.ServerAddress); } return(this); }
internal HostConnection RemoveConnection(ConnectionBase conn, HTTPConnectionStates setState) { conn.State = setState; conn.Dispose(); bool found = this.Connections.Remove(conn); if (!found) { HTTPManager.Logger.Warning(typeof(HostConnection).Name, string.Format("'{0}': RemoveConnection - Couldn't find connection! key: {1}", this.VariantId, conn.ServerAddress)); } return(this); }
public virtual void DisposeTest() { ConnectionBase conn = CreateConnection("test"); try { GetConnectionAccessor(conn).Socket = new ClientSocketMock(); conn.Open(); Assert.IsTrue(conn.IsConnected); conn.Dispose(); Assert.IsFalse(conn.IsConnected); } finally { conn.Close(); } }
protected override void Dispose(bool disposing) { if (!_disposed) { if (disposing) { if (_connection != null) { try { _connection.Dispose(); } catch (Exception) { } _connection = null; } } _disposed = true; } }