fix panic cause segment fault (#843)

1. backtrace may fail on some platform such as armv7, should do it last in panic hook.
2. stun should not panic when bind v6 failed.
This commit is contained in:
Sijie.Sun
2025-05-11 21:34:24 +08:00
committed by GitHub
parent 95b12dda5a
commit d758a4958f
2 changed files with 73 additions and 17 deletions

View File

@@ -807,7 +807,10 @@ impl StunInfoCollector {
async fn get_public_ipv6(servers: &Vec<String>) -> Option<Ipv6Addr> {
let mut ips = HostResolverIter::new(servers.to_vec(), 10, true);
while let Some(ip) = ips.next().await {
let udp = Arc::new(UdpSocket::bind(format!("[::]:0")).await.unwrap());
let Ok(udp_socket) = UdpSocket::bind(format!("[::]:0")).await else {
break;
};
let udp = Arc::new(udp_socket);
let ret = StunClientBuilder::new(udp.clone())
.new_stun_client(ip)
.bind_request(false, false)