From b93d71899f1fc83bbc132a11f168224d0ef2c245 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Wed, 23 Sep 2026 19:58:58 +0800 Subject: [PATCH] cursor: say why the peer answers request_cursor_data with what it holds No controller sends it yet, and a review asked for it to go because a cache reset on the peer could leave a request unanswered. A shape the peer's cache dropped is rebuilt, and indexed again, the next time it is shown, before any connection names it by id, so the shape a controller has just been told to show is always there to give; that is the contract a future bounded controller relies on. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01EZ49AbZJYfm8NTp5yDPMab --- libs/base/protos/message.proto | 6 +++++- src/server/input_service.rs | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/base/protos/message.proto b/libs/base/protos/message.proto index 31ca9c37d..668dfff06 100644 --- a/libs/base/protos/message.proto +++ b/libs/base/protos/message.proto @@ -859,7 +859,11 @@ message Misc { DisplayResolution change_display_resolution = 36; MessageQuery message_query = 37; int32 follow_current_display = 38; - // Since 1.5.0: send the CursorData of this id again, if the shape was sent. + // Since 1.5.0: send the CursorData of this id again. No controller sends this yet; it is + // here so a controller can one day bound its own shape store and ask for the shape the + // peer just selected. The peer answers with what it holds then: a shape its cache dropped + // is rebuilt, and held again, the next time it is shown, before any connection names it + // by id again, so the shape just selected is always there to give. uint64 request_cursor_data = 39; } } diff --git a/src/server/input_service.rs b/src/server/input_service.rs index cfdd8fa3c..d1831a44c 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -514,7 +514,10 @@ lazy_static::lazy_static! { lazy_static::lazy_static! { // Every shape the service has sent, by content id, for a controller that asks for one - // again. A shape under several handles is one message here, shared with `cached_cursor_data`. + // again. A shape under several handles is one message here, shared with `cached_cursor_data`, + // so this holds no more than that cache and is cleared with it. A shape dropped from both is + // rebuilt here the next time it is shown, in `run_cursor`, before any connection sends its + // `cursor_id`: whatever a controller has just been told to show, it can ask for. static ref CURSOR_SHAPES: Mutex>> = Default::default(); }