net.dns: Prevent answers from immediately expiring even if TTL=0 (see #919)
authorKim Alvefur <zash@zash.se>
Tue, 13 Jun 2017 16:36:47 +0200
changeset 8166 a55eb6c3b45c
parent 8163 5566f82ffea4
child 8167 a395957f3bf2
child 8225 67a9d2de2300
net.dns: Prevent answers from immediately expiring even if TTL=0 (see #919)
net/dns.lua
--- a/net/dns.lua	Tue May 30 20:52:22 2017 +0100
+++ b/net/dns.lua	Tue Jun 13 16:36:47 2017 +0200
@@ -513,7 +513,7 @@
 	rr.ttl      = 0x10000*self:word() + self:word();
 	rr.rdlength = self:word();
 
-	rr.tod = self.time + rr.ttl;
+	rr.tod = self.time + math.min(rr.ttl, 1);
 
 	local remember = self.offset;
 	local rr_parser = self[dns.type[rr.type]];