Skip to content

Commit

Permalink
TTL
Browse files Browse the repository at this point in the history
  • Loading branch information
mili-tan committed Jun 6, 2024
1 parent 477a050 commit 9e9a88b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DnsCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ public static void Add(DnsMessage qMessage, DnsMessage aMessage)
var question = qMessage.Questions;
var answerRecords = aMessage.AnswerRecords ?? new List<DnsRecordBase>();
var ttl = (answerRecords.FirstOrDefault() ?? new ARecord(DomainName.Root, 60, IPAddress.Any)).TimeToLive;
if (ttl < 50) return;
Add(new CacheItem(question.First().ToString(), (answerRecords, aMessage.ReturnCode)), ttl);
}

public static void Add(List<DnsQuestion> question, List<DnsRecordBase> answerRecords, ReturnCode rCode)
{
var ttl = (answerRecords.FirstOrDefault() ?? new ARecord(DomainName.Root, 60, IPAddress.Any)).TimeToLive;
if (ttl < 50) return;
Add(new CacheItem(question.First().ToString(), (answerRecords, rCode)), ttl);
}

Expand Down

0 comments on commit 9e9a88b

Please sign in to comment.