Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Use original query TSigOptions on cached response.
Browse files Browse the repository at this point in the history
  • Loading branch information
stackia committed Jun 17, 2015
1 parent ea3505f commit 5c18eb7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions DNSAgent/DnsAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ await Task.Run(async () =>
{
DnsMessage message;
DnsQuestion question;
var responseFromCache = false;
var respondedFromCache = false;
try
{
Expand Down Expand Up @@ -241,9 +241,10 @@ await Task.Run(async () =>
var cachedMessage = entry.Message;
Logger.Info("-> #{0} served from cache.", message.TransactionID,
cachedMessage.TransactionID);
cachedMessage.TransactionID = message.TransactionID;
cachedMessage.TransactionID = message.TransactionID; // Update transaction ID
cachedMessage.TSigOptions = message.TSigOptions; // Update TSig options
message = cachedMessage;
responseFromCache = true;
respondedFromCache = true;
}
}
}
Expand Down Expand Up @@ -334,7 +335,7 @@ await Task.Run(async () =>
_udpListener.SendAsync(responseBuffer, responseBuffer.Length, udpMessage.RemoteEndPoint);
// Update cache
if (Options.CacheResponse && !responseFromCache)
if (Options.CacheResponse && !respondedFromCache)
Cache.Update(question, message, Options.CacheAge);
}
}
Expand Down

0 comments on commit 5c18eb7

Please sign in to comment.