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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZ49AbZJYfm8NTp5yDPMab
This commit is contained in:
rustdesk
2026-09-23 19:58:58 +08:00
co-authored by Claude Fable 5.1
parent 0f67165689
commit b93d71899f
2 changed files with 9 additions and 2 deletions
+5 -1
View File
@@ -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;
}
}
+4 -1
View File
@@ -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<HashMap<u64, Arc<Message>>> = Default::default();
}