refactor punch hole

This commit is contained in:
rustdesk 2022-12-09 20:59:25 +08:00
parent e1bc6e34b3
commit cb640e48c5

View File

@ -379,7 +379,10 @@ impl RendezvousMediator {
)
.await?;
let local_addr = socket.local_addr();
allow_err!(socket_client::connect_tcp(peer_addr, local_addr, 300).await);
// key important here for punch hole to tell gateway incoming peer is safe.
// before we use 300ms, 1000ms seems more safe.
// it can not be async here, because local_addr can not be reused, we must close the connection before use it again.
allow_err!(socket_client::connect_tcp(peer_addr, local_addr, 1000).await);
socket
};
let mut msg_out = Message::new();