public Proxy(IPEndPoint listenOn, IPEndPoint forwardTo, Action<byte[], int> logger = null) { _logger = logger; _forwardTo = forwardTo; _tcpListener = new TcpListener(listenOn); _streamCopier = new TcpStreamCopier(_sessions, _logger); }
public void Dispose() { if (_tcpListener != null) { _tcpListener.Stop(); _tcpListener = null; } if (_sessions != null) { _sessions.Clear(); _sessions = null; } if (_streamCopier != null) { _streamCopier.Dispose(); _streamCopier = null; } GC.SuppressFinalize(this); }