Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

use official async trait (#6765)

21pagese8731887756b
diff --git a/Cargo.lock b/Cargo.lock
index 0dfa4a1ac..66c13e91f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5236,7 +5236,6 @@ dependencies = [
"android_logger",
"arboard",
"async-process",
- "async-trait",
"base64",
"bytes",
"cc",
diff --git a/Cargo.toml b/Cargo.toml
index 12c261309..8db4d61ac 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -60,7 +60,6 @@ magnum-opus = { git = "https://github.com/rustdesk/magnum-opus" }
dasp = { version = "0.11", features = ["signal", "interpolate-linear", "interpolate"], optional = true }
rubato = { version = "0.12", optional = true }
samplerate = { version = "0.2", optional = true }
-async-trait = "0.1"
uuid = { version = "1.3", features = ["v4"] }
clap = "4.2"
rpassword = "7.2"
diff --git a/src/cli.rs b/src/cli.rs
index 021ad899b..4ab8e5547 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -41,7 +41,6 @@ impl Session {
}
}
-#[async_trait]
impl Interface for Session {
fn get_login_config_handler(&self) -> Arc<RwLock<LoginConfigHandler>> {
return self.lc.clone();
diff --git a/src/client.rs b/src/client.rs
index 4999cb9ad..7a39c7b1f 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -6,7 +6,6 @@ use std::{
sync::{mpsc, Arc, Mutex, RwLock},
};
-pub use async_trait::async_trait;
use bytes::Bytes;
#[cfg(not(any(target_os = "android", target_os = "linux")))]
use cpal::{
@@ -2649,7 +2648,6 @@ async fn send_switch_login_request(
}
/// Interface for client to send data and commands.
-#[async_trait]
pub trait Interface: Send + Clone + 'static + Sized {
/// Send message data to remote peer.
fn send(&self, data: Data);
diff --git a/src/server/video_service.rs b/src/server/video_service.rs
index 668d3a57f..b7c402587 100644
--- a/src/server/video_service.rs
+++ b/src/server/video_service.rs
@@ -741,10 +741,11 @@ fn try_broadcast_display_changed(
) {
log::info!("Display {} changed", display);
if let Some(msg_out) = make_display_changed_msg(display_idx, Some(display)) {
- sp.send(msg_out.clone());
+ let msg_out = Arc::new(msg_out);
+ sp.send_shared(msg_out.clone());
// switch display may occur before the first video frame, add snapshot to send to new subscribers
sp.snapshot(move |sps| {
- sps.send(msg_out.clone());
+ sps.send_shared(msg_out.clone());
Ok(())
})?;
bail!("SWITCH");
diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs
index 4c5785640..81b427768 100644
--- a/src/ui_session_interface.rs
+++ b/src/ui_session_interface.rs
@@ -2,7 +2,6 @@ use crate::{
common::{get_supported_keyboard_modes, is_keyboard_mode_supported},
input::{MOUSE_BUTTON_LEFT, MOUSE_TYPE_DOWN, MOUSE_TYPE_UP, MOUSE_TYPE_WHEEL},
};
-use async_trait::async_trait;
use bytes::Bytes;
use rdev::{Event, EventType::*, KeyCode};
use std::{
@@ -1305,7 +1304,6 @@ impl<T: InvokeUiSession> DerefMut for Session<T> {
impl<T: InvokeUiSession> FileManager for Session<T> {}
-#[async_trait]
impl<T: InvokeUiSession> Interface for Session<T> {
fn get_lch(&self) -> Arc<RwLock<LoginConfigHandler>> {
return self.lc.clone();