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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019UzcMTdYTEv2QbMHcTSUy3
This commit is contained in:
rustdesk
2026-08-25 09:15:52 +08:00
parent cc8537c104
commit 6b8182ed38
+5
View File
@@ -57,6 +57,11 @@ enum WebRTCConnectionState {
Closed(String), 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 { pub struct WebRTCStream {
pc: Arc<RTCPeerConnection>, pc: Arc<RTCPeerConnection>,
stream: Arc<Mutex<Arc<RTCDataChannel>>>, stream: Arc<Mutex<Arc<RTCDataChannel>>>,