fix(drm): follow allow-drm-capture in the startup warm and in running streams

- warm_availability reads the option inside its retry loop. It starts
  before the initial config sync from root, so a --server whose account
  config does not hold the option yet (a greeter account that gets no
  RUSTDESK_DRM_CAPTURE, or an account not yet synced) skipped the warm
  for its whole life and paid the cold probe on its first connection.
- handle_drm_conn checks the option per frame, next to the peer re-auth,
  so turning it off ends a stream that is already running rather than
  only refusing new ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1grQ39ByRWPUtTBdTzEBF
This commit is contained in:
rustdeskandClaude Opus 5.5 committed 2026-11-17 20:24:47 +08:00
1 parent 73d742919c
commit 3d14692552
2 files changed
+12 -5

No files matched your search

+4
View File
@@ -1073,6 +1073,10 @@ async fn handle_drm_conn(stream: Connection) -> ResultType<()> {
log::warn!("drm: _drm peer no longer matches the active session (or it is unknown); closing");
break;
}
if !crate::platform::linux::drm_capture_enabled() {
log::info!("drm: allow-drm-capture turned off; closing this stream");
break;
}
let gen = DRM_DISPLAY_GENERATION.load(Ordering::Acquire);
if gen != seen_gen {
seen_gen = gen;
+8 -5
View File
@@ -2019,14 +2019,15 @@ fn refresh_available_async() {
}
pub(super) fn warm_availability() {
if !crate::platform::linux::drm_capture_enabled() {
return;
}
// The option is read INSIDE the loop too: this starts before the initial config sync from
// root, so an account whose own config does not hold it yet reads it as off at first.
let mut enabled = false;
// The gate is INSIDE the loop because `get_display_server()` answers "x11" whenever loginctl
// cannot yet name the seat0 session. `is_x11_for_drm()` is that form minus the greeter
// blind spot, where plain `is_x11()` is permanently true.
for _ in 0..10 {
if crate::platform::linux::is_x11_for_drm() {
enabled = crate::platform::linux::drm_capture_enabled();
if !enabled || crate::platform::linux::is_x11_for_drm() {
std::thread::sleep(Duration::from_millis(300));
continue;
}
@@ -2054,7 +2055,9 @@ pub(super) fn warm_availability() {
Err(_) => std::thread::sleep(Duration::from_millis(300)),
}
}
log::info!("drm: consumer cache warm found no producer at startup (will probe lazily)");
if enabled {
log::info!("drm: consumer cache warm found no producer at startup (will probe lazily)");
}
}
/// With no verdict yet, a login probes now instead of answering "not yet"; that may wake displays.