public virtual void Dispose() { if (Interlocked.Increment(ref _disposed) != 1) { //Only dispose once return; } Connection.Logger.Verbose("Disposing Connection #{0} to {1}.", GetHashCode(), EndPoint.EndpointFriendlyName); _idleTimer.Dispose(); _tcpSocket.Dispose(); var readStream = Interlocked.Exchange(ref _readStream, null); if (readStream != null) { readStream.Dispose(); } }
public void Dispose() { socket?.Dispose(); }