fix(driver-galaxy): resolve High code-review findings (Driver.Galaxy-002, Driver.Galaxy-008)
Driver.Galaxy-002 — DataTypeMap.Map had no Int64 arm though MxValueDecoder/ MxValueEncoder both fully support Int64. Galaxy attributes with the Int64 mx_data_type code fell through to the String default, creating a String address-space node while runtime reads decoded a boxed long. Added `6 => DriverDataType.Int64`, extending the contiguous 0..5 scheme so the type map agrees with the decoder/encoder on all seven Galaxy data types. Driver.Galaxy-008 — after a stream fault the EventPump's StreamEvents consumer loop exited and its channel completed; EventPump.Start() is a no-op on a completed-but-non-null loop, so a replayed subscription had no consumer and ReplayAsync never re-registered the post-reconnect item handles. ReplayAsync now recreates the EventPump (RestartEventPumpForReplay) and rebinds the SubscriptionRegistry per subscription with the fresh item handles returned by the post-reconnect SubscribeBulkAsync, via new SubscriptionRegistry.SnapshotEntries and Rebind APIs. Regression tests: DataTypeMapTests (every code incl. Int64), SubscriptionRegistry Tests (Rebind/SnapshotEntries), EventPumpStreamFaultTests (faulted pump dead, fresh pump resumes dispatch). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,14 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Browse;
|
||||
/// to <see cref="DriverDataType.String"/> for unknown codes — keeps wire compatibility
|
||||
/// with deployed configs while we tighten this through the parity matrix.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Code <c>6</c> (Int64) extends the contiguous 0..5 scheme so the map covers the same
|
||||
/// seven Galaxy data types <c>MxValueDecoder</c> / <c>MxValueEncoder</c> already decode
|
||||
/// and encode (Boolean, Int32, Int64, Float32, Float64, String, DateTime). Without it an
|
||||
/// Int64 attribute fell through to the <see cref="DriverDataType.String"/> default,
|
||||
/// creating a String address-space node while runtime reads decoded a boxed <c>long</c> —
|
||||
/// a metadata / coercion mismatch (Driver.Galaxy-002).
|
||||
/// </remarks>
|
||||
internal static class DataTypeMap
|
||||
{
|
||||
public static DriverDataType Map(int mxDataType) => mxDataType switch
|
||||
@@ -18,6 +26,7 @@ internal static class DataTypeMap
|
||||
3 => DriverDataType.Float64,
|
||||
4 => DriverDataType.String,
|
||||
5 => DriverDataType.DateTime,
|
||||
6 => DriverDataType.Int64,
|
||||
_ => DriverDataType.String,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user