private void ForEachSession(Action<ProxySession> action, bool throwIfCancellationRequested = true)
{
foreach(var session in _sessions.Values)
{
if(throwIfCancellationRequested)
{
ThrowIfCancellationRequested();
}
if(session.IsDisposed)
{
continue;
}
try
{
action(session);
}
catch(ObjectDisposedException) { }
}
}