From 6b8182ed38b4c9d800ae4e168137000c3545536f Mon Sep 17 00:00:00 2001 From: rustdesk Date: Tue, 25 Aug 2026 09:15:52 +0800 Subject: [PATCH] webrtc: record why WebRTCStream has no Drop An absent impl is invisible in the source, and this one keeps being proposed. Closing on each clone's drop would end a live session the moment a losing race future is dropped; closing on the last clone is circular, since the cache entry is itself a clone and is removed by the state handler a close fires. Ownership is carried by `OffererGuard` and `Stream::WebRTC` instead, so say so where someone adding another holder will look. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_019UzcMTdYTEv2QbMHcTSUy3 --- src/webrtc.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/webrtc.rs b/src/webrtc.rs index 5a2bdb0e0..83ea5799f 100644 --- a/src/webrtc.rs +++ b/src/webrtc.rs @@ -57,6 +57,11 @@ enum WebRTCConnectionState { Closed(String), } +/// A shared handle, not an owner: every clone points at the same `pc`, and `SESSIONS` holds one +/// of those clones. Hence no `Drop` — closing per clone would kill a live session as soon as a +/// losing race future is dropped, and closing on the last clone would wait on the very close +/// that evicts the cache entry. Ownership is `OffererGuard` until a connection attempt adopts +/// the stream and `Stream::WebRTC` after; holding one outside those two means closing it by hand. pub struct WebRTCStream { pc: Arc, stream: Arc>>,