mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
Fix infinite recursion in the DNS resolver (#82)
This commit is contained in:
parent
c57c68ddf8
commit
81e7adb409
1 changed files with 9 additions and 0 deletions
|
@ -50,6 +50,15 @@ pub async fn resolve_address(address: &ServerAddress) -> Result<SocketAddr, Reso
|
|||
port: redirect_srv.port(),
|
||||
};
|
||||
|
||||
if redirect_address.host == address.host {
|
||||
let lookup_ip_result = resolver.lookup_ip(redirect_address.host).await;
|
||||
let lookup_ip = lookup_ip_result.map_err(|_| ResolverError::NoIp)?;
|
||||
return Ok(SocketAddr::new(
|
||||
lookup_ip.iter().next().unwrap(),
|
||||
redirect_address.port,
|
||||
))
|
||||
}
|
||||
|
||||
// debug!("redirecting to {:?}", redirect_address);
|
||||
|
||||
return resolve_address(&redirect_address).await;
|
||||
|
|
Loading…
Add table
Reference in a new issue