found one blank cm, still not find reason

This commit is contained in:
rustdesk 2022-04-29 19:40:53 +08:00
parent e2c9b78254
commit 1235edb239
2 changed files with 6 additions and 1 deletions

View File

@ -359,6 +359,7 @@ async fn start_ipc(cm: ConnectionManager) {
while let Some(result) = incoming.next().await {
match result {
Ok(stream) => {
log::debug!("Got new connection");
let mut stream = Connection::new(stream);
let cm = cm.clone();
let tx_file = tx_file.clone();
@ -377,6 +378,7 @@ async fn start_ipc(cm: ConnectionManager) {
Ok(Some(data)) => {
match data {
Data::Login{id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, file_transfer_enabled} => {
log::debug!("conn_id: {}", id);
conn_id = id;
tx_file.send(ClipboardFileData::Enable((id, file_transfer_enabled))).ok();
cm.add_connection(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, tx.clone());
@ -395,7 +397,9 @@ async fn start_ipc(cm: ConnectionManager) {
}
}
Some(data) = rx.recv() => {
allow_err!(stream.send(&data).await);
if stream.send(&data).await.is_err() {
break;
}
}
}
}

View File

@ -290,6 +290,7 @@ handler.removeConnection = function(id) {
connections.map(function(c, idx) {
if (c.id == id) i = idx;
});
if (i < 0) return;
connections.splice(i, 1);
if (connections.length == 0) {
handler.exit();