Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/arboard clipboard context timeout #7217

Merged

Conversation

fufesou
Copy link
Collaborator

@fufesou fufesou commented Feb 21, 2024

This PR may fix #6859 on Linux platform.

Issue

arboard uses a fixed duration(10ms) as the timeout for x11 connection.

https://github.com/1Password/arboard/blob/77e0e078eb460ac2fa0eda96124163c11ef6b2d1/src/platform/linux/x11.rs#L142

But for RustDesk, sometimes it needs about 20ms or more to connect x11.

So the text clipboard is not stable.

And if the following line fails, the "copy & paste" from client to host will not work anymore in that connection.

match ClipboardContext::new() {

Fixed

In this PR, retry and increasing timeout are added for new() and get_text().

        for i in 1..4 {
            arboard::Clipboard::set_x11_server_conn_timeout(dur * i);
            match arboard::Clipboard::new() {
                Ok(c) => return Ok(ClipboardContext(c)),
                Err(arboard::Error::X11ServerConnTimeout) => continue,
                Err(err) => return Err(err.into()),
            }
        }
        bail!("Failed to create clipboard context, timeout");

PR for arboard is also submitted.

Signed-off-by: fufesou <shuanglongchen@yeah.net>
Signed-off-by: fufesou <shuanglongchen@yeah.net>
Signed-off-by: fufesou <shuanglongchen@yeah.net>
@rustdesk rustdesk merged commit 25afdda into rustdesk:master Feb 21, 2024
18 checks passed
jurykor pushed a commit to spikszma/rustdesk that referenced this pull request Apr 8, 2024
* Fix. Set custom timeout for arboard clipboard

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* fix build

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Do not block tokio runtime

Signed-off-by: fufesou <shuanglongchen@yeah.net>

---------

Signed-off-by: fufesou <shuanglongchen@yeah.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy Paste not working in one direction (Remote -> Local)
2 participants