|
|
@@ -7,7 +7,7 @@ use hbb_common::{
|
|
7
|
7
|
stream::{SplitSink, StreamExt},
|
|
8
|
8
|
},
|
|
9
|
9
|
log,
|
|
10
|
|
- protobuf::{parse_from_bytes, Message as _},
|
|
|
10
|
+ protobuf::Message as _,
|
|
11
|
11
|
rendezvous_proto::*,
|
|
12
|
12
|
tcp::new_listener,
|
|
13
|
13
|
tokio::{self, net::TcpStream, sync::mpsc},
|
|
|
@@ -144,7 +144,7 @@ impl RendezvousServer {
|
|
144
|
144
|
let mut rs = rs.clone();
|
|
145
|
145
|
tokio::spawn(async move {
|
|
146
|
146
|
while let Some(Ok(bytes)) = b.next().await {
|
|
147
|
|
- if let Ok(msg_in) = parse_from_bytes::<RendezvousMessage>(&bytes) {
|
|
|
147
|
+ if let Ok(msg_in) = RendezvousMessage::parse_from_bytes(&bytes) {
|
|
148
|
148
|
match msg_in.union {
|
|
149
|
149
|
Some(rendezvous_message::Union::punch_hole_request(ph)) => {
|
|
150
|
150
|
allow_err!(rs.handle_tcp_punch_hole_request(addr, ph.id).await);
|
|
|
@@ -176,7 +176,7 @@ impl RendezvousServer {
|
|
176
|
176
|
addr: SocketAddr,
|
|
177
|
177
|
socket: &mut FramedSocket,
|
|
178
|
178
|
) -> ResultType<()> {
|
|
179
|
|
- if let Ok(msg_in) = parse_from_bytes::<RendezvousMessage>(&bytes) {
|
|
|
179
|
+ if let Ok(msg_in) = RendezvousMessage::parse_from_bytes(&bytes) {
|
|
180
|
180
|
match msg_in.union {
|
|
181
|
181
|
Some(rendezvous_message::Union::register_peer(rp)) => {
|
|
182
|
182
|
// B registered
|
|
|
@@ -193,6 +193,7 @@ impl RendezvousServer {
|
|
193
|
193
|
self.pm.update_pk(id, addr, rk.pk);
|
|
194
|
194
|
} else {
|
|
195
|
195
|
if peer.pk != rk.pk {
|
|
|
196
|
+ log::warn!("Peer {} pk mismatch: {:?} vs {:?}", id, rk.pk, peer.pk);
|
|
196
|
197
|
res = register_pk_response::Result::PK_MISMATCH;
|
|
197
|
198
|
}
|
|
198
|
199
|
}
|