mirror of
https://github.com/EasyTier/EasyTier.git
synced 2024-11-16 11:42:27 +08:00
fix cone-to-cone punch (#401)
This commit is contained in:
parent
63821e56bc
commit
e344372616
|
@ -110,12 +110,18 @@ impl PunchConeHoleClient {
|
||||||
.with_context(|| anyhow::anyhow!("failed to get local port from udp array"))?;
|
.with_context(|| anyhow::anyhow!("failed to get local port from udp array"))?;
|
||||||
let local_port = local_addr.port();
|
let local_port = local_addr.port();
|
||||||
|
|
||||||
|
drop(local_socket);
|
||||||
let local_mapped_addr = global_ctx
|
let local_mapped_addr = global_ctx
|
||||||
.get_stun_info_collector()
|
.get_stun_info_collector()
|
||||||
.get_udp_port_mapping(local_port)
|
.get_udp_port_mapping(local_port)
|
||||||
.await
|
.await
|
||||||
.with_context(|| "failed to get udp port mapping")?;
|
.with_context(|| "failed to get udp port mapping")?;
|
||||||
|
|
||||||
|
let local_socket = {
|
||||||
|
let _g = self.peer_mgr.get_global_ctx().net_ns.guard();
|
||||||
|
Arc::new(UdpSocket::bind(local_addr).await?)
|
||||||
|
};
|
||||||
|
|
||||||
// client -> server: tell server the mapped port, server will return the mapped address of listening port.
|
// client -> server: tell server the mapped port, server will return the mapped address of listening port.
|
||||||
let rpc_stub = self
|
let rpc_stub = self
|
||||||
.peer_mgr
|
.peer_mgr
|
||||||
|
|
Loading…
Reference in New Issue
Block a user