refactor(net): converge live session state reset
This commit is contained in:
parent
78a9223b65
commit
4f31a5085f
35 changed files with 1460 additions and 83 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue