Skip to content

Commit

Permalink
fix: self config to tcp connection if the response is truncated
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscaOrtegaG committed Jul 26, 2024
1 parent be0552f commit c132d3e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/async_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ impl AsyncResolver {
let response = self
.inner_lookup(domain_name_struct, Rrtype::A, rclass.into())
.await;

return self
.check_error_from_msg(response)
.and_then(|lookup_response| {
if lookup_response.to_dns_msg().get_header().get_tc() {
self.config.set_protocol(ConnectionProtocol::TCP);
}
let rrs_iter = lookup_response.to_vec_of_rr().into_iter();
let ip_addresses: Result<Vec<IpAddr>, _> = rrs_iter
.map(|rr| AsyncResolver::from_rr_to_ip(rr))
Expand Down Expand Up @@ -320,6 +323,7 @@ impl AsyncResolver {
if !truncated {
cache.add(response.clone());
}

}
}

Expand Down

0 comments on commit c132d3e

Please sign in to comment.