fix(dcl): bind the reconnect re-subscribe loop to its session; shared supervisory advise ignores the first caller's token (DCL-4, DCL-9, WP3 task 3.3)

This commit is contained in:
Joseph Doherty
2026-12-03 09:57:13 -05:00
parent 2e8bede3b2
commit d52aff1bee
7 changed files with 317 additions and 14 deletions
@@ -215,10 +215,13 @@ public class OpcUaDataConnection
IReadOnlyList<string> tagPaths, SubscriptionCallback callback, CancellationToken cancellationToken = default)
{
EnsureConnected();
// Dereference the session's client ONCE (DCL-4): a reconnect swaps _client, and a call
// must run entirely against the client it started on.
var client = _client!;
// ONE shared callback for the whole batch — the client hands back the node id
// (== tag path for OPC UA), so no per-tag closure is needed.
var outcomes = await _client!.CreateSubscriptionsAsync(
var outcomes = await client.CreateSubscriptionsAsync(
tagPaths,
(nodeId, value, timestamp, statusCode) =>
{