Skip to content

Commit

Permalink
fix: test now pases, check TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
joalopez1206 committed Oct 10, 2024
1 parent ea740da commit ab68385
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/async_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ mod async_resolver_test {
.cache
.lock()
.unwrap()
.get_cache_answer()
.get_cache_additional()
.get_cache()
.len(),
1
Expand Down
11 changes: 10 additions & 1 deletion src/resolver_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ impl ResolverCache {
qclass: Rclass,
rcode: Option<Rcode>,
) {
/*
The meaning of the TTL field is a time limit on how long an RR can be
kept in a cache. This limit does not apply to authoritative data in
zones; it is also timed out, but by the refreshing policies for the
zone.
*/
if resource_record.get_ttl() > 0 {
self.cache_authority
.add(domain_name, resource_record, qtype, qclass, rcode);
Expand All @@ -100,7 +106,10 @@ impl ResolverCache {
qclass: Rclass,
rcode: Option<Rcode>,
) {
if resource_record.get_ttl() > 0 {
// Seems like SOA is a special record
// Nope! it should be in authority
// TODO: add this to auth (ttl rules does not apply in that section)
if resource_record.get_ttl() > 0 || resource_record.get_rtype() == Rrtype::SOA {
if resource_record.get_rtype() != Rrtype::OPT {
self.cache_additional
.add(domain_name, resource_record, qtype, qclass, rcode);
Expand Down

0 comments on commit ab68385

Please sign in to comment.