fix nat probe bug
This commit is contained in:
parent
51c323008a
commit
c070d345ad
@ -400,22 +400,18 @@ impl Node {
|
||||
};
|
||||
|
||||
if reply1.ip == self.outer_ip_v4.load(Ordering::Relaxed) {
|
||||
let Ok(reply2) = self
|
||||
.send_and_wait_for_probe_reply(StunProbeAttr::None, &self.config.nat_server2)
|
||||
let Ok(_reply2) = self
|
||||
.send_and_wait_for_probe_reply(StunProbeAttr::Peer, &self.config.nat_server1)
|
||||
.await
|
||||
else {
|
||||
*self.nat_type.lock().unwrap() = NatType::Blocked;
|
||||
return NatType::Blocked;
|
||||
};
|
||||
if reply1.ip != reply2.ip || reply1.port != reply2.port {
|
||||
*self.nat_type.lock().unwrap() = NatType::Symmetric;
|
||||
return NatType::Symmetric;
|
||||
}
|
||||
};
|
||||
*self.nat_type.lock().unwrap() = NatType::NoNat;
|
||||
return NatType::NoNat;
|
||||
}
|
||||
|
||||
if let Ok(_reply3) = self
|
||||
if let Ok(_reply2_2) = self
|
||||
.send_and_wait_for_probe_reply(StunProbeAttr::Peer, &self.config.nat_server1)
|
||||
.await
|
||||
{
|
||||
@ -423,6 +419,18 @@ impl Node {
|
||||
return NatType::FullCone;
|
||||
}
|
||||
|
||||
let Ok(reply3) = self
|
||||
.send_and_wait_for_probe_reply(StunProbeAttr::None, &self.config.nat_server2)
|
||||
.await
|
||||
else {
|
||||
*self.nat_type.lock().unwrap() = NatType::Blocked;
|
||||
return NatType::Blocked;
|
||||
};
|
||||
if reply3.ip != reply1.ip || reply3.port != reply1.port {
|
||||
*self.nat_type.lock().unwrap() = NatType::Symmetric;
|
||||
return NatType::Symmetric;
|
||||
}
|
||||
|
||||
if let Ok(_reply4) = self
|
||||
.send_and_wait_for_probe_reply(StunProbeAttr::Port, &self.config.nat_server1)
|
||||
.await
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user