fix(ab-transport): trim-only CIP path canonicalisation, observe abandoned shared opens, no Forward Open after dispose during connect

This commit is contained in:
Joseph Doherty
2026-10-07 16:49:19 -04:00
parent a251954bf7
commit 33dbd342e5
5 changed files with 41 additions and 8 deletions
@@ -162,6 +162,7 @@ public sealed class DeviceSessionPoolTests
b.ShouldBe(a);
b.GetHashCode().ShouldBe(a.GetHashCode());
(a with { CipPath = "1, 2" }).CipPath.ShouldBe("1,2");
new DeviceKey("plc1", 44818, " ", "ControlLogix").CipPath.ShouldBe("");
var pool = new DeviceSessionPool(new ManualTimeProvider());
await using var la = pool.Acquire(a, Options());
@@ -170,6 +171,16 @@ public sealed class DeviceSessionPoolTests
pool.EntryCount.ShouldBe(1);
}
[Fact]
public void Whitespace_inside_a_cip_path_part_is_kept_so_a_typo_fails_loudly()
{
var typo = new DeviceKey("plc1", 44818, "1,2 3", "ControlLogix");
typo.CipPath.ShouldNotBe("1,23"); // never silently slot 23 on another controller
typo.CipPath.ShouldBe("1,2 3");
Should.Throw<ArgumentException>(() => CipPath.EncodeRoute(typo.CipPath));
CipPath.EncodeRoute(new DeviceKey("plc1", 44818, " 1, 0 ", "ControlLogix").CipPath).ShouldBe(new byte[] { 0x01, 0x00 });
}
[Fact]
public async Task A_new_connection_waits_for_every_earlier_close_not_just_the_latest()
{