mirror of
https://github.com/rustdesk/hbb_common.git
synced 2026-08-27 04:37:35 +00:00
cc8537c1042529e79cde185795843e6b8d342900
`test_cancelled_new_does_not_leak_the_pc` cancelled `new()` with a zero timeout and discarded whatever came back. The cancellation is not guaranteed to win: the setup task runs on WEBRTC_RT, and it can finish inside the single poll the timeout allows, in which case `new()` returns a live stream. `WebRTCStream` has no `Drop`, so `let _ =` on that one strands its pc in SESSIONS — and the test then reported the leak it had just created, blaming the cancelled attempt. Fewer test threads leave more CPU for that task, so it won the race often enough that `--test-threads=2` failed every run while the default count passed; the entry that survived carried `conn=New`, `sig=HaveLocalOffer` and a `Pending` state watch, i.e. a pc nobody had ever closed. Close what a lost race hands back and retry for a real cancellation, asserting that one happened rather than testing nothing. 24 tests now pass at 1, 2, 4, 8 and default threads. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019UzcMTdYTEv2QbMHcTSUy3
Description
No description provided
Languages
Rust
100%