fix: win remote and file transfer , simultaneous connection

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2022-10-31 10:04:59 +08:00
parent e263acef3e
commit d6c9639c5d
7 changed files with 28 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
use crate::client::{
Client, CodecFormat, FileManager, MediaData, MediaSender, QualityStatus, MILLI1, SEC30,
Client, CodecFormat, MediaData, MediaSender, QualityStatus, MILLI1, SEC30,
SERVER_CLIPBOARD_ENABLED, SERVER_FILE_TRANSFER_ENABLED, SERVER_KEYBOARD_ENABLED,
};
use crate::common;
@@ -15,7 +15,7 @@ use crate::{client::Data, client::Interface};
use hbb_common::config::{PeerConfig, TransferSerde};
use hbb_common::fs::{
can_enable_overwrite_detection, get_job, get_string, new_send_confirm, DigestCheckResult,
RemoveJobMeta, TransferJobMeta,
RemoveJobMeta,
};
use hbb_common::message_proto::permission_info::Permission;
use hbb_common::protobuf::Message as _;
@@ -23,6 +23,7 @@ use hbb_common::rendezvous_proto::ConnType;
use hbb_common::tokio::{
self,
sync::mpsc,
sync::Mutex as TokioMutex,
time::{self, Duration, Instant, Interval},
};
use hbb_common::{
@@ -113,15 +114,23 @@ impl<T: InvokeUiSession> Remote<T> {
// just build for now
#[cfg(not(windows))]
let (_tx_holder, mut rx_clip_client) = mpsc::unbounded_channel::<i32>();
#[cfg(windows)]
let (client_conn_id, rx_clip_client1) =
clipboard::get_rx_cliprdr_client(&self.handler.id);
let (_tx_holder, rx) = mpsc::unbounded_channel();
#[cfg(windows)]
let mut rx_clip_client = rx_clip_client1.lock().await;
let mut rx_clip_client_lock = Arc::new(TokioMutex::new(rx));
#[cfg(windows)]
{
self.client_conn_id = client_conn_id;
let is_conn_not_default = self.handler.is_file_transfer()
|| self.handler.is_port_forward()
|| self.handler.is_rdp();
if !is_conn_not_default {
(self.client_conn_id, rx_clip_client_lock) =
clipboard::get_rx_cliprdr_client(&self.handler.id);
};
}
#[cfg(windows)]
let mut rx_clip_client = rx_clip_client_lock.lock().await;
let mut status_timer = time::interval(Duration::new(1, 0));