private void RemoveSession(ProxySession session) { lock (sessions) { session.Close(); sessions.Remove(session); } }
public void Stop() { if (listener != null) { try { listener.Stop(); } catch { } listener = null; } if (thread != null) { try { thread.Abort(); } catch { thread = null; } } lock (sessions) { while (sessions.Count > 0) { ProxySession session = sessions[0]; session.Close(); sessions.Remove(session); } sessions.Clear(); } }