Browse Source

fix test_hbb and bump version 1.1.8

rustdesk 2 years ago
parent
commit
3a7904fa8e
5 changed files with 103 additions and 52 deletions
  1. 85 44
      Cargo.lock
  2. 1 1
      Cargo.toml
  3. BIN
      db_v2.sqlite3
  4. 2 3
      libs/hbb_common/src/config.rs
  5. 15 4
      src/rendezvous_server.rs

+ 85 - 44
Cargo.lock

@@ -276,12 +276,6 @@ dependencies = [
276
  "toml",
276
  "toml",
277
 ]
277
 ]
278
 
278
 
279
-[[package]]
280
-name = "const-sha1"
281
-version = "0.2.0"
282
-source = "registry+https://github.com/rust-lang/crates.io-index"
283
-checksum = "fb58b6451e8c2a812ad979ed1d83378caa5e927eef2622017a45f251457c2c9d"
284
-
285
 [[package]]
279
 [[package]]
286
 name = "core-foundation"
280
 name = "core-foundation"
287
 version = "0.9.3"
281
 version = "0.9.3"
@@ -785,7 +779,7 @@ dependencies = [
785
 
779
 
786
 [[package]]
780
 [[package]]
787
 name = "hbbs"
781
 name = "hbbs"
788
-version = "1.1.7-1"
782
+version = "1.1.8"
789
 dependencies = [
783
 dependencies = [
790
  "async-speed-limit",
784
  "async-speed-limit",
791
  "async-trait",
785
  "async-trait",
@@ -1086,15 +1080,14 @@ dependencies = [
1086
 
1080
 
1087
 [[package]]
1081
 [[package]]
1088
 name = "local-ip-address"
1082
 name = "local-ip-address"
1089
-version = "0.4.4"
1083
+version = "0.5.3"
1090
 source = "registry+https://github.com/rust-lang/crates.io-index"
1084
 source = "registry+https://github.com/rust-lang/crates.io-index"
1091
-checksum = "8b143c6ef86e36328caa40a7578e95d1544aca8a1740235fd2b416a69441a5c7"
1085
+checksum = "2815836665de176ba66deaa449ada98fdf208d84730d1a84a22cbeed6151a6fa"
1092
 dependencies = [
1086
 dependencies = [
1093
  "libc",
1087
  "libc",
1094
- "memalloc",
1095
  "neli",
1088
  "neli",
1096
  "thiserror",
1089
  "thiserror",
1097
- "windows",
1090
+ "windows-sys 0.48.0",
1098
 ]
1091
 ]
1099
 
1092
 
1100
 [[package]]
1093
 [[package]]
@@ -1147,12 +1140,6 @@ version = "0.5.0"
1147
 source = "registry+https://github.com/rust-lang/crates.io-index"
1140
 source = "registry+https://github.com/rust-lang/crates.io-index"
1148
 checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb"
1141
 checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb"
1149
 
1142
 
1150
-[[package]]
1151
-name = "memalloc"
1152
-version = "0.1.0"
1153
-source = "registry+https://github.com/rust-lang/crates.io-index"
1154
-checksum = "df39d232f5c40b0891c10216992c2f250c054105cb1e56f0fc9032db6203ecc1"
1155
-
1156
 [[package]]
1143
 [[package]]
1157
 name = "memchr"
1144
 name = "memchr"
1158
 version = "2.5.0"
1145
 version = "2.5.0"
@@ -1222,7 +1209,7 @@ dependencies = [
1222
  "libc",
1209
  "libc",
1223
  "log",
1210
  "log",
1224
  "wasi 0.11.0+wasi-snapshot-preview1",
1211
  "wasi 0.11.0+wasi-snapshot-preview1",
1225
- "windows-sys",
1212
+ "windows-sys 0.36.1",
1226
 ]
1213
 ]
1227
 
1214
 
1228
 [[package]]
1215
 [[package]]
@@ -1236,12 +1223,27 @@ dependencies = [
1236
 
1223
 
1237
 [[package]]
1224
 [[package]]
1238
 name = "neli"
1225
 name = "neli"
1239
-version = "0.5.3"
1226
+version = "0.6.4"
1240
 source = "registry+https://github.com/rust-lang/crates.io-index"
1227
 source = "registry+https://github.com/rust-lang/crates.io-index"
1241
-checksum = "9053554eb5dcb7e10d9cdab1206965bde870eed5d0d341532ca035e3ba221508"
1228
+checksum = "1100229e06604150b3becd61a4965d5c70f3be1759544ea7274166f4be41ef43"
1242
 dependencies = [
1229
 dependencies = [
1243
  "byteorder",
1230
  "byteorder",
1244
  "libc",
1231
  "libc",
1232
+ "log",
1233
+ "neli-proc-macros",
1234
+]
1235
+
1236
+[[package]]
1237
+name = "neli-proc-macros"
1238
+version = "0.1.3"
1239
+source = "registry+https://github.com/rust-lang/crates.io-index"
1240
+checksum = "c168194d373b1e134786274020dae7fc5513d565ea2ebb9bc9ff17ffb69106d4"
1241
+dependencies = [
1242
+ "either",
1243
+ "proc-macro2",
1244
+ "quote",
1245
+ "serde",
1246
+ "syn",
1245
 ]
1247
 ]
1246
 
1248
 
1247
 [[package]]
1249
 [[package]]
@@ -1403,7 +1405,7 @@ dependencies = [
1403
  "libc",
1405
  "libc",
1404
  "redox_syscall",
1406
  "redox_syscall",
1405
  "smallvec",
1407
  "smallvec",
1406
- "windows-sys",
1408
+ "windows-sys 0.36.1",
1407
 ]
1409
 ]
1408
 
1410
 
1409
 [[package]]
1411
 [[package]]
@@ -2730,29 +2732,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2730
 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
2732
 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
2731
 
2733
 
2732
 [[package]]
2734
 [[package]]
2733
-name = "windows"
2734
-version = "0.18.0"
2735
+name = "windows-sys"
2736
+version = "0.36.1"
2735
 source = "registry+https://github.com/rust-lang/crates.io-index"
2737
 source = "registry+https://github.com/rust-lang/crates.io-index"
2736
-checksum = "68088239696c06152844eadc03d262f088932cce50c67e4ace86e19d95e976fe"
2738
+checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
2737
 dependencies = [
2739
 dependencies = [
2738
- "const-sha1",
2739
- "windows_gen",
2740
- "windows_macros",
2740
+ "windows_aarch64_msvc 0.36.1",
2741
+ "windows_i686_gnu 0.36.1",
2742
+ "windows_i686_msvc 0.36.1",
2743
+ "windows_x86_64_gnu 0.36.1",
2744
+ "windows_x86_64_msvc 0.36.1",
2741
 ]
2745
 ]
2742
 
2746
 
2743
 [[package]]
2747
 [[package]]
2744
 name = "windows-sys"
2748
 name = "windows-sys"
2745
-version = "0.36.1"
2749
+version = "0.48.0"
2746
 source = "registry+https://github.com/rust-lang/crates.io-index"
2750
 source = "registry+https://github.com/rust-lang/crates.io-index"
2747
-checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
2751
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
2748
 dependencies = [
2752
 dependencies = [
2749
- "windows_aarch64_msvc",
2750
- "windows_i686_gnu",
2751
- "windows_i686_msvc",
2752
- "windows_x86_64_gnu",
2753
- "windows_x86_64_msvc",
2753
+ "windows-targets",
2754
 ]
2754
 ]
2755
 
2755
 
2756
+[[package]]
2757
+name = "windows-targets"
2758
+version = "0.48.0"
2759
+source = "registry+https://github.com/rust-lang/crates.io-index"
2760
+checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
2761
+dependencies = [
2762
+ "windows_aarch64_gnullvm",
2763
+ "windows_aarch64_msvc 0.48.0",
2764
+ "windows_i686_gnu 0.48.0",
2765
+ "windows_i686_msvc 0.48.0",
2766
+ "windows_x86_64_gnu 0.48.0",
2767
+ "windows_x86_64_gnullvm",
2768
+ "windows_x86_64_msvc 0.48.0",
2769
+]
2770
+
2771
+[[package]]
2772
+name = "windows_aarch64_gnullvm"
2773
+version = "0.48.0"
2774
+source = "registry+https://github.com/rust-lang/crates.io-index"
2775
+checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
2776
+
2756
 [[package]]
2777
 [[package]]
2757
 name = "windows_aarch64_msvc"
2778
 name = "windows_aarch64_msvc"
2758
 version = "0.36.1"
2779
 version = "0.36.1"
@@ -2760,10 +2781,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2760
 checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
2781
 checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
2761
 
2782
 
2762
 [[package]]
2783
 [[package]]
2763
-name = "windows_gen"
2764
-version = "0.18.0"
2784
+name = "windows_aarch64_msvc"
2785
+version = "0.48.0"
2765
 source = "registry+https://github.com/rust-lang/crates.io-index"
2786
 source = "registry+https://github.com/rust-lang/crates.io-index"
2766
-checksum = "cf583322dc423ee021035b358e535015f7fd163058a31e2d37b99a939141121d"
2787
+checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
2767
 
2788
 
2768
 [[package]]
2789
 [[package]]
2769
 name = "windows_i686_gnu"
2790
 name = "windows_i686_gnu"
@@ -2771,6 +2792,12 @@ version = "0.36.1"
2771
 source = "registry+https://github.com/rust-lang/crates.io-index"
2792
 source = "registry+https://github.com/rust-lang/crates.io-index"
2772
 checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
2793
 checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
2773
 
2794
 
2795
+[[package]]
2796
+name = "windows_i686_gnu"
2797
+version = "0.48.0"
2798
+source = "registry+https://github.com/rust-lang/crates.io-index"
2799
+checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
2800
+
2774
 [[package]]
2801
 [[package]]
2775
 name = "windows_i686_msvc"
2802
 name = "windows_i686_msvc"
2776
 version = "0.36.1"
2803
 version = "0.36.1"
@@ -2778,14 +2805,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2778
 checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
2805
 checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
2779
 
2806
 
2780
 [[package]]
2807
 [[package]]
2781
-name = "windows_macros"
2782
-version = "0.18.0"
2808
+name = "windows_i686_msvc"
2809
+version = "0.48.0"
2783
 source = "registry+https://github.com/rust-lang/crates.io-index"
2810
 source = "registry+https://github.com/rust-lang/crates.io-index"
2784
-checksum = "58acfb8832e9f707f8997bd161e537a1c1f603e60a5bd9c3cf53484fdcc998f3"
2785
-dependencies = [
2786
- "syn",
2787
- "windows_gen",
2788
-]
2811
+checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
2789
 
2812
 
2790
 [[package]]
2813
 [[package]]
2791
 name = "windows_x86_64_gnu"
2814
 name = "windows_x86_64_gnu"
@@ -2793,12 +2816,30 @@ version = "0.36.1"
2793
 source = "registry+https://github.com/rust-lang/crates.io-index"
2816
 source = "registry+https://github.com/rust-lang/crates.io-index"
2794
 checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
2817
 checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
2795
 
2818
 
2819
+[[package]]
2820
+name = "windows_x86_64_gnu"
2821
+version = "0.48.0"
2822
+source = "registry+https://github.com/rust-lang/crates.io-index"
2823
+checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
2824
+
2825
+[[package]]
2826
+name = "windows_x86_64_gnullvm"
2827
+version = "0.48.0"
2828
+source = "registry+https://github.com/rust-lang/crates.io-index"
2829
+checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
2830
+
2796
 [[package]]
2831
 [[package]]
2797
 name = "windows_x86_64_msvc"
2832
 name = "windows_x86_64_msvc"
2798
 version = "0.36.1"
2833
 version = "0.36.1"
2799
 source = "registry+https://github.com/rust-lang/crates.io-index"
2834
 source = "registry+https://github.com/rust-lang/crates.io-index"
2800
 checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
2835
 checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
2801
 
2836
 
2837
+[[package]]
2838
+name = "windows_x86_64_msvc"
2839
+version = "0.48.0"
2840
+source = "registry+https://github.com/rust-lang/crates.io-index"
2841
+checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
2842
+
2802
 [[package]]
2843
 [[package]]
2803
 name = "winreg"
2844
 name = "winreg"
2804
 version = "0.6.2"
2845
 version = "0.6.2"

+ 1 - 1
Cargo.toml

@@ -1,6 +1,6 @@
1
 [package]
1
 [package]
2
 name = "hbbs"
2
 name = "hbbs"
3
-version = "1.1.7-1"
3
+version = "1.1.8"
4
 authors = ["rustdesk <info@rustdesk.com>"]
4
 authors = ["rustdesk <info@rustdesk.com>"]
5
 edition = "2021"
5
 edition = "2021"
6
 build = "build.rs"
6
 build = "build.rs"

BIN
db_v2.sqlite3


+ 2 - 3
libs/hbb_common/src/config.rs

@@ -337,14 +337,13 @@ impl Config2 {
337
 pub fn load_path<T: serde::Serialize + serde::de::DeserializeOwned + Default + std::fmt::Debug>(
337
 pub fn load_path<T: serde::Serialize + serde::de::DeserializeOwned + Default + std::fmt::Debug>(
338
     file: PathBuf,
338
     file: PathBuf,
339
 ) -> T {
339
 ) -> T {
340
-    let cfg = match confy::load_path(file) {
340
+    match confy::load_path(file) {
341
         Ok(config) => config,
341
         Ok(config) => config,
342
         Err(err) => {
342
         Err(err) => {
343
             log::error!("Failed to load config: {}", err);
343
             log::error!("Failed to load config: {}", err);
344
             T::default()
344
             T::default()
345
         }
345
         }
346
-    };
347
-    cfg
346
+    }
348
 }
347
 }
349
 
348
 
350
 #[inline]
349
 #[inline]

+ 15 - 4
src/rendezvous_server.rs

@@ -1,7 +1,7 @@
1
 use crate::common::*;
1
 use crate::common::*;
2
 use crate::peer::*;
2
 use crate::peer::*;
3
 use hbb_common::{
3
 use hbb_common::{
4
-    allow_err,
4
+    allow_err, bail,
5
     bytes::{Bytes, BytesMut},
5
     bytes::{Bytes, BytesMut},
6
     bytes_codec::BytesCodec,
6
     bytes_codec::BytesCodec,
7
     config,
7
     config,
@@ -166,7 +166,10 @@ impl RendezvousServer {
166
                 test_addr.parse()?
166
                 test_addr.parse()?
167
             };
167
             };
168
             tokio::spawn(async move {
168
             tokio::spawn(async move {
169
-                allow_err!(test_hbbs(test_addr).await);
169
+                if let Err(err) = test_hbbs(test_addr).await {
170
+                    log::error!("Failed to run hbbs test with {test_addr}: {err}");
171
+                    std::process::exit(1);
172
+                }
170
             });
173
             });
171
         };
174
         };
172
         let main_task = async move {
175
         let main_task = async move {
@@ -1225,6 +1228,15 @@ async fn check_relay_servers(rs0: Arc<RelayServers>, tx: Sender) {
1225
 
1228
 
1226
 // temp solution to solve udp socket failure
1229
 // temp solution to solve udp socket failure
1227
 async fn test_hbbs(addr: SocketAddr) -> ResultType<()> {
1230
 async fn test_hbbs(addr: SocketAddr) -> ResultType<()> {
1231
+    let mut addr = addr;
1232
+    if addr.ip().is_unspecified() {
1233
+        addr.set_ip(if addr.is_ipv4() {
1234
+            IpAddr::V4(Ipv4Addr::LOCALHOST)
1235
+        } else {
1236
+            IpAddr::V6(Ipv6Addr::LOCALHOST)
1237
+        });
1238
+    }
1239
+
1228
     let mut socket = FramedSocket::new(config::Config::get_any_listen_addr(addr.is_ipv4())).await?;
1240
     let mut socket = FramedSocket::new(config::Config::get_any_listen_addr(addr.is_ipv4())).await?;
1229
     let mut msg_out = RendezvousMessage::new();
1241
     let mut msg_out = RendezvousMessage::new();
1230
     msg_out.set_register_peer(RegisterPeer {
1242
     msg_out.set_register_peer(RegisterPeer {
@@ -1238,8 +1250,7 @@ async fn test_hbbs(addr: SocketAddr) -> ResultType<()> {
1238
         tokio::select! {
1250
         tokio::select! {
1239
           _ = timer.tick() => {
1251
           _ = timer.tick() => {
1240
               if last_time_recv.elapsed().as_secs() > 12 {
1252
               if last_time_recv.elapsed().as_secs() > 12 {
1241
-                 log::error!("Timeout of test_hbbs");
1242
-                 std::process::exit(1);
1253
+                  bail!("Timeout of test_hbbs");
1243
               }
1254
               }
1244
               socket.send(&msg_out, addr).await?;
1255
               socket.send(&msg_out, addr).await?;
1245
           }
1256
           }