open-trade лет назад: 5
Родитель
Сommit
9feb083a37
3 измененных файлов с 21 добавлено и 21 удалено
  1. 14 14
      Cargo.lock
  2. 1 1
      libs/hbb_common
  3. 6 6
      src/rendezvous_server.rs

+ 14 - 14
Cargo.lock

@@ -172,8 +172,8 @@ dependencies = [
172 172
  "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
173 173
  "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
174 174
  "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
175
- "protobuf 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
176
- "protobuf-codegen-pure 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
175
+ "protobuf 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)",
176
+ "protobuf-codegen-pure 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)",
177 177
  "socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
178 178
  "tokio 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
179 179
  "tokio-util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -364,24 +364,24 @@ dependencies = [
364 364
 
365 365
 [[package]]
366 366
 name = "protobuf"
367
-version = "2.10.2"
368
-source = "registry+https://github.com/rust-lang/crates.io-index"
367
+version = "3.0.0-pre"
368
+source = "git+https://github.com/stepancheg/rust-protobuf#bd2bc3bdbf52bd9bbc700e67f1fdaa95465b0ccb"
369 369
 
370 370
 [[package]]
371 371
 name = "protobuf-codegen"
372
-version = "2.10.2"
373
-source = "registry+https://github.com/rust-lang/crates.io-index"
372
+version = "3.0.0-pre"
373
+source = "git+https://github.com/stepancheg/rust-protobuf#bd2bc3bdbf52bd9bbc700e67f1fdaa95465b0ccb"
374 374
 dependencies = [
375
- "protobuf 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
375
+ "protobuf 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)",
376 376
 ]
377 377
 
378 378
 [[package]]
379 379
 name = "protobuf-codegen-pure"
380
-version = "2.10.2"
381
-source = "registry+https://github.com/rust-lang/crates.io-index"
380
+version = "3.0.0-pre"
381
+source = "git+https://github.com/stepancheg/rust-protobuf#bd2bc3bdbf52bd9bbc700e67f1fdaa95465b0ccb"
382 382
 dependencies = [
383
- "protobuf 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
384
- "protobuf-codegen 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
383
+ "protobuf 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)",
384
+ "protobuf-codegen 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)",
385 385
 ]
386 386
 
387 387
 [[package]]
@@ -637,9 +637,9 @@ dependencies = [
637 637
 "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
638 638
 "checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e"
639 639
 "checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
640
-"checksum protobuf 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "37a5325d019a4d837d3abde0a836920f959e33d350f77b5f1e289e061e774942"
641
-"checksum protobuf-codegen 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "64dd3a6192e0c6c1b0dae8f125b7f6b201c39fc487ebda0ee717d7a87fc47dc2"
642
-"checksum protobuf-codegen-pure 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "037fa49710ee83b3be232ed53c5fce0bdb1b64c6aa6b1143a86640969c3e4b1d"
640
+"checksum protobuf 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)" = "<none>"
641
+"checksum protobuf-codegen 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)" = "<none>"
642
+"checksum protobuf-codegen-pure 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)" = "<none>"
643 643
 "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
644 644
 "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
645 645
 "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"

+ 1 - 1
libs/hbb_common

@@ -1 +1 @@
1
-Subproject commit 9a2d8c3925eb69c76aba9f798fdc84a40aa68e86
1
+Subproject commit 9cccda60ea8d9e7006b2f5f35898e39c77a6c8d8

+ 6 - 6
src/rendezvous_server.rs

@@ -43,7 +43,7 @@ impl RendezvousServer {
43 43
     ) -> ResultType<()> {
44 44
         if let Ok(msg_in) = parse_from_bytes::<RendezvousMessage>(&bytes) {
45 45
             match msg_in.union {
46
-                Some(RendezvousMessage_oneof_union::register_peer(rp)) => {
46
+                Some(rendezvous_message::Union::register_peer(rp)) => {
47 47
                     // B registered
48 48
                     if rp.id.len() > 0 {
49 49
                         log::debug!("New peer registered: {:?} {:?}", &rp.id, &addr);
@@ -53,7 +53,7 @@ impl RendezvousServer {
53 53
                         socket.send(&msg_out, addr).await?
54 54
                     }
55 55
                 }
56
-                Some(RendezvousMessage_oneof_union::punch_hole_request(ph)) => {
56
+                Some(rendezvous_message::Union::punch_hole_request(ph)) => {
57 57
                     // punch hole request from A, forward to B,
58 58
                     // check if in same intranet first,
59 59
                     // fetch local addrs if in same intranet.
@@ -99,13 +99,13 @@ impl RendezvousServer {
99 99
                     } else {
100 100
                         let mut msg_out = RendezvousMessage::new();
101 101
                         msg_out.set_punch_hole_response(PunchHoleResponse {
102
-                            failure: PunchHoleResponse_Failure::ID_NOT_EXIST,
102
+                            failure: punch_hole_response::Failure::ID_NOT_EXIST.into(),
103 103
                             ..Default::default()
104 104
                         });
105 105
                         socket.send(&msg_out, addr).await?
106 106
                     }
107 107
                 }
108
-                Some(RendezvousMessage_oneof_union::punch_hole_sent(phs)) => {
108
+                Some(rendezvous_message::Union::punch_hole_sent(phs)) => {
109 109
                     // punch hole sent from B, tell A that B is ready to be connected
110 110
                     let addr_a = AddrMangle::decode(&phs.socket_addr);
111 111
                     log::debug!("Punch hole response to {:?} from {:?}", &addr_a, &addr);
@@ -116,7 +116,7 @@ impl RendezvousServer {
116 116
                     });
117 117
                     socket.send(&msg_out, addr_a).await?;
118 118
                 }
119
-                Some(RendezvousMessage_oneof_union::local_addr(la)) => {
119
+                Some(rendezvous_message::Union::local_addr(la)) => {
120 120
                     // forward local addrs of B to A
121 121
                     let addr_a = AddrMangle::decode(&la.socket_addr);
122 122
                     log::debug!("Local addrs response to {:?} from {:?}", &addr_a, &addr);
@@ -137,7 +137,7 @@ impl RendezvousServer {
137 137
 #[cfg(test)]
138 138
 mod tests {
139 139
     use super::*;
140
-    use hbb_common::{tokio};
140
+    use hbb_common::tokio;
141 141
 
142 142
     #[allow(unused_must_use)]
143 143
     #[tokio::main]