Commit Graph
4 Commits
Author SHA1 Message Date
swaits 055fc76b87 fix: prevent client from stealing serial port when mux is restarting
Track mux usage with a static AtomicBool. Once a mux connection
succeeds, all future connect() calls in the same process only try
the mux. connect() blocks waiting for the socket to reappear;
try_connect() returns an error so callers can retry with backoff.
2026-04-11 02:50:49 -06:00
swaits 77addfa698 fix: connect() no longer falls through from mux to USB serial
When a mux socket file exists, connect(None, timeout) and try_connect()
now commit to the mux — returning an error if unreachable instead of
silently falling through to USB serial. This prevents a race condition
where a client could steal the serial port from the mux during reconnect.

Callers with explicit port = Some(...) are unaffected.
2026-04-07 18:04:07 -06:00
swaits a7e93ab56b feat!: v0.2.0 — ping-on-connect validation, try_connect, publish polish
- Add ping-on-connect handshake: all connect functions validate the device
  within 200ms, rejecting non-DongLoRa serial devices immediately
- Add try_connect() — non-blocking connect that errors instead of blocking
  forever when no USB device is present
- Add payload size validation in transmit() (max 256 bytes)
- Add ErrorCode: impl std::error::Error
- Fix drain_rx error handling (no longer swallows original error)
- Fix repository URL to github.com/donglora/client-rs
- Remove wire-level tag constants from top-level re-exports
- Add rust-version (MSRV 1.85), homepage, exclude fields to Cargo.toml
- Add examples/ping.rs
- Allow clippy unwrap/expect in test modules
2026-04-07 15:52:37 -06:00
swaits 7dd717a887 fix(clients/rust): harden client resilience for v0.1.0 release
- Track serial timeout in field instead of returning hardcoded 2s
- Always restore timeout in drain_rx, even on read errors
- Handle EINTR/Interrupted in read_frame (retry instead of error)
- Use connect_timeout for TCP mux (no more 2-min hangs)
- Set write timeout on mux sockets (unix + tcp)
- Log unexpected unsolicited frames in recv via tracing::warn
- Add unix socket timeout test for WouldBlock handling
- Add CHANGELOG.md, remove resolved CLAUDE_TODO.md
2026-04-06 14:00:42 -06:00