fix(dcl): separator-aware alarm routing, typed reply for browse/search while disconnected, server-timestamp fallback (DCL-5, DCL-6, DCL-7, WP3 task 3.4)

This commit is contained in:
Joseph Doherty
2026-12-03 10:04:02 -05:00
parent d52aff1bee
commit c000ee3203
8 changed files with 267 additions and 25 deletions
@@ -448,23 +448,33 @@ public class OpcUaDataConnection
}
/// <inheritdoc />
public Task<BrowseChildrenResult> BrowseChildrenAsync(
public async Task<BrowseChildrenResult> BrowseChildrenAsync(
string? parentNodeId,
string? continuationToken = null,
CancellationToken cancellationToken = default)
=> _client!.BrowseChildrenAsync(parentNodeId, continuationToken, cancellationToken);
{
// async so a not-connected adapter FAULTS the task instead of throwing synchronously
// (DCL-6): a freshly swapped failover adapter has no client until the reconnect timer
// fires, and the old `_client!` dereference threw a NullReferenceException on the actor
// thread, so the caller got no reply at all.
var client = _client
?? throw new ConnectionNotConnectedException("OPC UA client is not connected.");
return await client.BrowseChildrenAsync(parentNodeId, continuationToken, cancellationToken);
}
/// <inheritdoc />
public Task<AddressSpaceSearchResult> SearchAddressSpaceAsync(
public async Task<AddressSpaceSearchResult> SearchAddressSpaceAsync(
string query, int maxDepth, int maxResults, CancellationToken cancellationToken = default)
{
// Guard connection state with the typed ConnectionNotConnectedException so
// the site-side handler can map it uniformly (mirrors BrowseChildrenAsync,
// whose underlying client throws the same type when the session is down).
if (_client == null || !_client.IsConnected)
// async so the guard faults the task rather than throwing synchronously (DCL-6).
var client = _client;
if (client == null || !client.IsConnected)
throw new ConnectionNotConnectedException("OPC UA client is not connected.");
return _client.SearchAddressSpaceAsync(query, maxDepth, maxResults, cancellationToken);
return await client.SearchAddressSpaceAsync(query, maxDepth, maxResults, cancellationToken);
}
private void StopHeartbeatMonitor()