From a3511d915734a031e39606dce354faa7725f0631 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Mon, 24 Jan 2022 02:26:07 +0800 Subject: [PATCH] update crates, and set new default #cpu --- Cargo.lock | 141 +++++++++++++++++++----------------- Cargo.toml | 3 +- libs/hbb_common/Cargo.toml | 2 +- src/client.rs | 2 +- src/ipc.rs | 4 +- src/server/video_service.rs | 2 +- 6 files changed, 80 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0b3f90ae9..6256946e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,9 +83,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.52" +version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3" +checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0" [[package]] name = "arboard" @@ -375,9 +375,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.0.9" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c506244a13c87262f84bf16369740d0b7c3850901b6a642aa41b031a710c473" +checksum = "7a30c3bf9ff12dfe5dae53f0a96e0febcd18420d1c0e7fad77796d9d5c4b5375" dependencies = [ "atty", "bitflags", @@ -404,9 +404,9 @@ dependencies = [ [[package]] name = "clipboard-win" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1951fb8aa063a2ee18b4b4d217e4aa2ec9cc4f2430482983f607fa10cd36d7aa" +checksum = "b4d3d118de1bf9678546f65e12f749b46abb5a56129d435af21fc7e42768f974" dependencies = [ "error-code", "str-buf", @@ -499,7 +499,7 @@ version = "0.4.1" source = "git+https://github.com/open-trade/confy#27fa12941291b44ccd856aef4a5452c1eb646047" dependencies = [ "directories", - "serde 1.0.133", + "serde 1.0.135", "toml", ] @@ -638,9 +638,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" +checksum = "a2209c310e29876f7f0b2721e7e26b84aff178aa3da5d091f9bfbf47669e60e3" dependencies = [ "cfg-if 1.0.0", ] @@ -1011,7 +1011,7 @@ checksum = "7f3f119846c823f9eafcf953a8f6ffb6ed69bf6240883261a7f13b634579a51f" dependencies = [ "lazy_static", "regex", - "serde 1.0.133", + "serde 1.0.135", "strsim 0.10.0", ] @@ -1045,7 +1045,7 @@ dependencies = [ "log", "objc", "pkg-config", - "serde 1.0.133", + "serde 1.0.135", "serde_derive", "unicode-segmentation", "winapi 0.3.9", @@ -1090,9 +1090,9 @@ dependencies = [ [[package]] name = "error-code" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5115567ac25674e0043e472be13d14e537f37ea8aa4bdc4aef0c89add1db1ff" +checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" dependencies = [ "libc", "str-buf", @@ -1109,9 +1109,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" dependencies = [ "instant", ] @@ -1721,9 +1721,9 @@ dependencies = [ "quinn", "rand 0.8.4", "regex", - "serde 1.0.133", + "serde 1.0.135", "serde_derive", - "serde_json 1.0.75", + "serde_json 1.0.78", "socket2 0.3.19", "sodiumoxide", "tokio", @@ -1868,12 +1868,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - [[package]] name = "itoa" version = "1.0.1" @@ -1917,9 +1911,9 @@ checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" [[package]] name = "js-sys" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" dependencies = [ "wasm-bindgen", ] @@ -1969,9 +1963,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.112" +version = "0.2.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +checksum = "eef78b64d87775463c549fbd80e19249ef436ea3bf1de2a1eb7e717ec7fab1e9" [[package]] name = "libdbus-sys" @@ -2085,7 +2079,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89544d9544366f6cda81244514a80809b137b5a179947b73bfa9f2797480de69" dependencies = [ - "nix 0.22.0", + "nix 0.22.3", "winapi 0.3.9", ] @@ -2377,9 +2371,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.22.0" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1e25ee6b412c2a1e3fcb6a4499a5c1bfe7f43e014bdce9a6b6666e5aa2d187" +checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" dependencies = [ "bitflags", "cc", @@ -2550,6 +2544,15 @@ dependencies = [ "syn", ] +[[package]] +name = "num_threads" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71a1eb3a36534514077c1e079ada2fb170ef30c47d203aa6916138cf882ecd52" +dependencies = [ + "libc", +] + [[package]] name = "objc" version = "0.2.7" @@ -2999,16 +3002,16 @@ dependencies = [ "libc", "mio 0.7.14", "quinn-proto", - "socket2 0.4.2", + "socket2 0.4.3", "tokio", "tracing", ] [[package]] name = "quote" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" +checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" dependencies = [ "proc-macro2", ] @@ -3361,7 +3364,7 @@ dependencies = [ "base64", "cc", "cfg-if 1.0.0", - "clap 3.0.9", + "clap 3.0.10", "clipboard-master", "cocoa 0.24.0", "core-foundation 0.9.2", @@ -3384,6 +3387,7 @@ dependencies = [ "machine-uid", "magnum-opus", "notify", + "num_cpus", "objc", "parity-tokio-ipc", "rdev", @@ -3395,9 +3399,9 @@ dependencies = [ "samplerate", "sciter-rs", "scrap", - "serde 1.0.133", + "serde 1.0.135", "serde_derive", - "serde_json 1.0.75", + "serde_json 1.0.78", "sha2", "sys-locale", "sysinfo", @@ -3529,7 +3533,7 @@ dependencies = [ "num_cpus", "quest", "repng", - "serde 1.0.133", + "serde 1.0.135", "target_build_utils", "tracing", "webm", @@ -3577,18 +3581,18 @@ checksum = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af" [[package]] name = "serde" -version = "1.0.133" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" +checksum = "2cf9235533494ea2ddcdb794665461814781c53f19d87b76e571a1c35acbad2b" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.133" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" +checksum = "8dcde03d87d4c973c04be249e7d8f0b35db1c848c487bd43032808e59dd8328d" dependencies = [ "proc-macro2", "quote", @@ -3609,13 +3613,13 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.75" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c059c05b48c5c0067d4b4b2b4f0732dd65feb52daf7e0ea09cd87e7dadc1af79" +checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085" dependencies = [ "itoa 1.0.1", "ryu", - "serde 1.0.133", + "serde 1.0.135", ] [[package]] @@ -3687,9 +3691,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" +checksum = "0f82496b90c36d70af5fcd482edaa2e0bd16fade569de1330405fecbbdac736b" dependencies = [ "libc", "winapi 0.3.9", @@ -3704,7 +3708,7 @@ dependencies = [ "ed25519", "libc", "libsodium-sys", - "serde 1.0.133", + "serde 1.0.135", ] [[package]] @@ -3769,9 +3773,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7" +checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" dependencies = [ "proc-macro2", "quote", @@ -3805,9 +3809,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f1bfab07306a27332451a662ca9c8156e3a9986f82660ba9c8e744fe8455d43" +checksum = "9e757000a4bed2b1be9be65a3f418b9696adf30bb419214c73997422de73a591" dependencies = [ "cfg-if 1.0.0", "core-foundation-sys 0.8.3", @@ -3937,12 +3941,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad" +checksum = "c8d54b9298e05179c335de2b9645d061255bcd5155f843b3e328d2cfe0a5b413" dependencies = [ - "itoa 0.4.8", + "itoa 1.0.1", "libc", + "num_threads", "time-macros", ] @@ -4000,7 +4005,7 @@ dependencies = [ [[package]] name = "tokio-socks" version = "0.5.1" -source = "git+https://github.com/fufesou/tokio-socks#63e27388e4d569316945c1c24353010d86f342a6" +source = "git+https://github.com/open-trade/tokio-socks#3de8300fbce37e2cdaef042e016aa95058d007cf" dependencies = [ "bytes", "either", @@ -4035,7 +4040,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" dependencies = [ - "serde 1.0.133", + "serde 1.0.135", ] [[package]] @@ -4156,9 +4161,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -4166,9 +4171,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" dependencies = [ "bumpalo", "lazy_static", @@ -4181,9 +4186,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4191,9 +4196,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" dependencies = [ "proc-macro2", "quote", @@ -4204,15 +4209,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" [[package]] name = "web-sys" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" +checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 4dccf9ebf..a6218e983 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,8 @@ uuid = { version = "0.8", features = ["v4"] } clap = "3.0" rpassword = "5.0" base64 = "0.13" -sysinfo = "0.22" +sysinfo = "0.23" +num_cpus = "1.13" [target.'cfg(not(any(target_os = "android")))'.dependencies] cpal = { git = "https://github.com/open-trade/cpal" } diff --git a/libs/hbb_common/Cargo.toml b/libs/hbb_common/Cargo.toml index d1868f5b5..c8193474a 100644 --- a/libs/hbb_common/Cargo.toml +++ b/libs/hbb_common/Cargo.toml @@ -29,7 +29,7 @@ dirs-next = "2.0" filetime = "0.2" sodiumoxide = "0.2" regex = "1.4" -tokio-socks = { git = "https://github.com/fufesou/tokio-socks" } +tokio-socks = { git = "https://github.com/open-trade/tokio-socks" } [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] mac_address = "1.1" diff --git a/src/client.rs b/src/client.rs index 3b7251f2f..e74ecbc59 100644 --- a/src/client.rs +++ b/src/client.rs @@ -638,7 +638,7 @@ pub struct VideoHandler { impl VideoHandler { pub fn new() -> Self { VideoHandler { - decoder: Decoder::new(VideoCodecId::VP9, 0).unwrap(), + decoder: Decoder::new(VideoCodecId::VP9, (num_cpus::get() / 2) as _).unwrap(), rgb: Default::default(), } } diff --git a/src/ipc.rs b/src/ipc.rs index bc25f803b..b9c74655a 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -307,8 +307,8 @@ async fn check_pid(postfix: &str) { use sysinfo::{ProcessExt, System, SystemExt}; let mut sys = System::new(); sys.refresh_processes(); - if let Some(p) = sys.process(pid) { - if let Some(current) = sys.process(std::process::id() as _) { + if let Some(p) = sys.process(pid.into()) { + if let Some(current) = sys.process((std::process::id() as i32).into()) { if current.name() == p.name() { // double check with connect if connect(1000, postfix).await.is_ok() { diff --git a/src/server/video_service.rs b/src/server/video_service.rs index 5b6d857cc..68faf178e 100644 --- a/src/server/video_service.rs +++ b/src/server/video_service.rs @@ -188,7 +188,7 @@ fn run(sp: GenericService) -> ResultType<()> { speed, }; let mut vpx; - match Encoder::new(&cfg, 0) { + match Encoder::new(&cfg, (num_cpus::get() / 2) as _) { Ok(x) => vpx = x, Err(err) => bail!("Failed to create encoder: {}", err), }