fix: compile
This commit is contained in:
parent
6de6d6c7a7
commit
c4d41c21f3
@ -5,6 +5,7 @@ use hbb_common::{
|
|||||||
compress::decompress,
|
compress::decompress,
|
||||||
config::{Config, LocalConfig},
|
config::{Config, LocalConfig},
|
||||||
fs, log,
|
fs, log,
|
||||||
|
fs::can_enable_overwrite_detection,
|
||||||
message_proto::*,
|
message_proto::*,
|
||||||
protobuf::Message as _,
|
protobuf::Message as _,
|
||||||
rendezvous_proto::ConnType,
|
rendezvous_proto::ConnType,
|
||||||
@ -14,6 +15,7 @@ use hbb_common::{
|
|||||||
time::{self, Duration, Instant, Interval},
|
time::{self, Duration, Instant, Interval},
|
||||||
},
|
},
|
||||||
Stream,
|
Stream,
|
||||||
|
get_version_number
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
collections::{HashMap, VecDeque},
|
collections::{HashMap, VecDeque},
|
||||||
@ -192,9 +194,9 @@ impl Session {
|
|||||||
Self::send_msg_static(msg_out);
|
Self::send_msg_static(msg_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_files(id: i32, path: String, to: String, include_hidden: bool, is_remote: bool) {
|
pub fn send_files(id: i32, path: String, to: String, file_num: i32, include_hidden: bool, is_remote: bool) {
|
||||||
if let Some(session) = SESSION.write().unwrap().as_mut() {
|
if let Some(session) = SESSION.write().unwrap().as_mut() {
|
||||||
session.send_files(id, path, to, include_hidden, is_remote);
|
session.send_files(id, path, to, file_num, include_hidden, is_remote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -732,14 +734,29 @@ impl Connection {
|
|||||||
Data::Message(msg) => {
|
Data::Message(msg) => {
|
||||||
allow_err!(peer.send(&msg).await);
|
allow_err!(peer.send(&msg).await);
|
||||||
}
|
}
|
||||||
Data::SendFiles((id, path, to, include_hidden, is_remote)) => {
|
Data::SendFiles((id, path, to, file_num, include_hidden, is_remote)) => {
|
||||||
|
// in mobile, can_enable_override_detection is always true
|
||||||
|
let od = true;
|
||||||
if is_remote {
|
if is_remote {
|
||||||
log::debug!("New job {}, write to {} from remote {}", id, to, path);
|
log::debug!("New job {}, write to {} from remote {}", id, to, path);
|
||||||
self.write_jobs
|
self.write_jobs
|
||||||
.push(fs::TransferJob::new_write(id, to, Vec::new()));
|
.push(fs::TransferJob::new_write(id,
|
||||||
allow_err!(peer.send(&fs::new_send(id, path, include_hidden)).await);
|
path.clone(),
|
||||||
|
to,
|
||||||
|
file_num,
|
||||||
|
include_hidden,
|
||||||
|
is_remote,
|
||||||
|
Vec::new(),
|
||||||
|
true));
|
||||||
|
allow_err!(peer.send(&fs::new_send(id, path, file_num, include_hidden)).await);
|
||||||
} else {
|
} else {
|
||||||
match fs::TransferJob::new_read(id, path.clone(), include_hidden) {
|
match fs::TransferJob::new_read(id,
|
||||||
|
to.clone(),
|
||||||
|
path.clone(),
|
||||||
|
file_num,
|
||||||
|
include_hidden,
|
||||||
|
is_remote,
|
||||||
|
true) {
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
self.handle_job_status(id, -1, Some(err.to_string()));
|
self.handle_job_status(id, -1, Some(err.to_string()));
|
||||||
}
|
}
|
||||||
@ -754,7 +771,7 @@ impl Connection {
|
|||||||
let files = job.files().clone();
|
let files = job.files().clone();
|
||||||
self.read_jobs.push(job);
|
self.read_jobs.push(job);
|
||||||
self.timer = time::interval(MILLI1);
|
self.timer = time::interval(MILLI1);
|
||||||
allow_err!(peer.send(&fs::new_receive(id, to, files)).await);
|
allow_err!(peer.send(&fs::new_receive(id, to, file_num, files)).await);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1180,11 +1197,18 @@ pub mod connection_manager {
|
|||||||
ipc::FS::NewWrite {
|
ipc::FS::NewWrite {
|
||||||
path,
|
path,
|
||||||
id,
|
id,
|
||||||
|
file_num,
|
||||||
mut files,
|
mut files,
|
||||||
} => {
|
} => {
|
||||||
|
// in mobile, can_enable_override_detection is always true
|
||||||
|
let od = true;
|
||||||
WRITE_JOBS.lock().unwrap().push(fs::TransferJob::new_write(
|
WRITE_JOBS.lock().unwrap().push(fs::TransferJob::new_write(
|
||||||
id,
|
id,
|
||||||
|
"".to_string(),
|
||||||
path,
|
path,
|
||||||
|
file_num,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
files
|
files
|
||||||
.drain(..)
|
.drain(..)
|
||||||
.map(|f| FileEntry {
|
.map(|f| FileEntry {
|
||||||
@ -1193,6 +1217,7 @@ pub mod connection_manager {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
|
true
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
ipc::FS::CancelWrite { id } => {
|
ipc::FS::CancelWrite { id } => {
|
||||||
|
@ -324,12 +324,14 @@ unsafe extern "C" fn set_by_name(name: *const c_char, value: *const c_char) {
|
|||||||
Some(id),
|
Some(id),
|
||||||
Some(path),
|
Some(path),
|
||||||
Some(to),
|
Some(to),
|
||||||
|
Some(file_num),
|
||||||
Some(show_hidden),
|
Some(show_hidden),
|
||||||
Some(is_remote),
|
Some(is_remote),
|
||||||
) = (
|
) = (
|
||||||
m.get("id"),
|
m.get("id"),
|
||||||
m.get("path"),
|
m.get("path"),
|
||||||
m.get("to"),
|
m.get("to"),
|
||||||
|
m.get("file_num"),
|
||||||
m.get("show_hidden"),
|
m.get("show_hidden"),
|
||||||
m.get("is_remote"),
|
m.get("is_remote"),
|
||||||
) {
|
) {
|
||||||
@ -337,6 +339,7 @@ unsafe extern "C" fn set_by_name(name: *const c_char, value: *const c_char) {
|
|||||||
id.parse().unwrap_or(0),
|
id.parse().unwrap_or(0),
|
||||||
path.to_owned(),
|
path.to_owned(),
|
||||||
to.to_owned(),
|
to.to_owned(),
|
||||||
|
file_num.parse().unwrap_or(0),
|
||||||
show_hidden.eq("true"),
|
show_hidden.eq("true"),
|
||||||
is_remote.eq("true"),
|
is_remote.eq("true"),
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user