- Manager with injectable enumerateFunc and serialOpener for test isolation - goroutine-per-device model: deviceLoop owns one serial port per device - context+done-channel teardown: inner read goroutine exits on ctx.Done() - Read buffer capped at 4096 bytes (T-04-01 threat mitigation) - Poll loop reconciles prev/current snapshots for connect/disconnect events - ErrDeviceNotConnected returned by Send() when device absent - All 5 manager tests pass with -race flag; goroutine count stable across 5 replug cycles - mockPort test helper blocks Read until Close() unblocks it (realistic behavior) |
||
|---|---|---|
| .. | ||
| device.go | ||
| device_test.go | ||
| enumerate.go | ||
| manager.go | ||
| manager_test.go | ||
| mock_port_test.go | ||