refactor(net): converge live session state reset

This commit is contained in:
Erik 2026-07-21 12:00:48 +02:00
parent 78a9223b65
commit 4f31a5085f
35 changed files with 1460 additions and 83 deletions

View file

@ -101,12 +101,24 @@ public sealed class ExternalContainerState
bool changed = previous != 0u || RequestedContainerId != 0u;
CurrentContainerId = 0u;
RequestedContainerId = 0u;
if (changed)
var transition = new ExternalContainerTransition(
ExternalContainerTransitionKind.Reset,
previous,
0u);
Action<ExternalContainerTransition>? listeners = Changed;
if (listeners is not null)
{
Changed?.Invoke(new ExternalContainerTransition(
ExternalContainerTransitionKind.Reset,
previous,
0u));
List<Exception>? failures = null;
foreach (Action<ExternalContainerTransition> listener in listeners.GetInvocationList())
{
try { listener(transition); }
catch (Exception error) { (failures ??= []).Add(error); }
}
if (failures is not null)
throw new AggregateException(
"One or more external-container reset observers failed.",
failures);
}
return changed;
}