upgrade protobuf

This commit is contained in:
open-trade 2020-04-21 23:49:31 +08:00
parent a21a47a2a6
commit 9feb083a37
3 changed files with 21 additions and 21 deletions

28
Cargo.lock generated
View File

@ -172,8 +172,8 @@ dependencies = [
"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)",
"protobuf-codegen-pure 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf-codegen-pure 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)",
"socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -364,24 +364,24 @@ dependencies = [
[[package]] [[package]]
name = "protobuf" name = "protobuf"
version = "2.10.2" version = "3.0.0-pre"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/stepancheg/rust-protobuf#bd2bc3bdbf52bd9bbc700e67f1fdaa95465b0ccb"
[[package]] [[package]]
name = "protobuf-codegen" name = "protobuf-codegen"
version = "2.10.2" version = "3.0.0-pre"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/stepancheg/rust-protobuf#bd2bc3bdbf52bd9bbc700e67f1fdaa95465b0ccb"
dependencies = [ dependencies = [
"protobuf 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)",
] ]
[[package]] [[package]]
name = "protobuf-codegen-pure" name = "protobuf-codegen-pure"
version = "2.10.2" version = "3.0.0-pre"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/stepancheg/rust-protobuf#bd2bc3bdbf52bd9bbc700e67f1fdaa95465b0ccb"
dependencies = [ dependencies = [
"protobuf 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)",
"protobuf-codegen 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf-codegen 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)",
] ]
[[package]] [[package]]
@ -637,9 +637,9 @@ dependencies = [
"checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
"checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" "checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e"
"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" "checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
"checksum protobuf 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "37a5325d019a4d837d3abde0a836920f959e33d350f77b5f1e289e061e774942" "checksum protobuf 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)" = "<none>"
"checksum protobuf-codegen 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "64dd3a6192e0c6c1b0dae8f125b7f6b201c39fc487ebda0ee717d7a87fc47dc2" "checksum protobuf-codegen 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)" = "<none>"
"checksum protobuf-codegen-pure 2.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "037fa49710ee83b3be232ed53c5fce0bdb1b64c6aa6b1143a86640969c3e4b1d" "checksum protobuf-codegen-pure 3.0.0-pre (git+https://github.com/stepancheg/rust-protobuf)" = "<none>"
"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"

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

View File

@ -43,7 +43,7 @@ impl RendezvousServer {
) -> ResultType<()> { ) -> ResultType<()> {
if let Ok(msg_in) = parse_from_bytes::<RendezvousMessage>(&bytes) { if let Ok(msg_in) = parse_from_bytes::<RendezvousMessage>(&bytes) {
match msg_in.union { match msg_in.union {
Some(RendezvousMessage_oneof_union::register_peer(rp)) => { Some(rendezvous_message::Union::register_peer(rp)) => {
// B registered // B registered
if rp.id.len() > 0 { if rp.id.len() > 0 {
log::debug!("New peer registered: {:?} {:?}", &rp.id, &addr); log::debug!("New peer registered: {:?} {:?}", &rp.id, &addr);
@ -53,7 +53,7 @@ impl RendezvousServer {
socket.send(&msg_out, addr).await? socket.send(&msg_out, addr).await?
} }
} }
Some(RendezvousMessage_oneof_union::punch_hole_request(ph)) => { Some(rendezvous_message::Union::punch_hole_request(ph)) => {
// punch hole request from A, forward to B, // punch hole request from A, forward to B,
// check if in same intranet first, // check if in same intranet first,
// fetch local addrs if in same intranet. // fetch local addrs if in same intranet.
@ -99,13 +99,13 @@ impl RendezvousServer {
} else { } else {
let mut msg_out = RendezvousMessage::new(); let mut msg_out = RendezvousMessage::new();
msg_out.set_punch_hole_response(PunchHoleResponse { msg_out.set_punch_hole_response(PunchHoleResponse {
failure: PunchHoleResponse_Failure::ID_NOT_EXIST, failure: punch_hole_response::Failure::ID_NOT_EXIST.into(),
..Default::default() ..Default::default()
}); });
socket.send(&msg_out, addr).await? socket.send(&msg_out, addr).await?
} }
} }
Some(RendezvousMessage_oneof_union::punch_hole_sent(phs)) => { Some(rendezvous_message::Union::punch_hole_sent(phs)) => {
// punch hole sent from B, tell A that B is ready to be connected // punch hole sent from B, tell A that B is ready to be connected
let addr_a = AddrMangle::decode(&phs.socket_addr); let addr_a = AddrMangle::decode(&phs.socket_addr);
log::debug!("Punch hole response to {:?} from {:?}", &addr_a, &addr); log::debug!("Punch hole response to {:?} from {:?}", &addr_a, &addr);
@ -116,7 +116,7 @@ impl RendezvousServer {
}); });
socket.send(&msg_out, addr_a).await?; socket.send(&msg_out, addr_a).await?;
} }
Some(RendezvousMessage_oneof_union::local_addr(la)) => { Some(rendezvous_message::Union::local_addr(la)) => {
// forward local addrs of B to A // forward local addrs of B to A
let addr_a = AddrMangle::decode(&la.socket_addr); let addr_a = AddrMangle::decode(&la.socket_addr);
log::debug!("Local addrs response to {:?} from {:?}", &addr_a, &addr); log::debug!("Local addrs response to {:?} from {:?}", &addr_a, &addr);
@ -137,7 +137,7 @@ impl RendezvousServer {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use hbb_common::{tokio}; use hbb_common::tokio;
#[allow(unused_must_use)] #[allow(unused_must_use)]
#[tokio::main] #[tokio::main]