Comparison

net/dns.lua @ 8263:9b52b1f19b51

net.dns: Correctly apply lower bound of RTT (thanks Ge0rG)
author Kim Alvefur <zash@zash.se>
date Sun, 24 Sep 2017 01:04:56 +0200
parent 8164:a395957f3bf2
child 8427:1371518f70ff
child 8421:3d21c63ec03f
comparison
equal deleted inserted replaced
8262:e6f3e440c843 8263:9b52b1f19b51
502 rr.type = dns.type[self:word()] or rr.type; 502 rr.type = dns.type[self:word()] or rr.type;
503 rr.class = dns.class[self:word()] or rr.class; 503 rr.class = dns.class[self:word()] or rr.class;
504 rr.ttl = 0x10000*self:word() + self:word(); 504 rr.ttl = 0x10000*self:word() + self:word();
505 rr.rdlength = self:word(); 505 rr.rdlength = self:word();
506 506
507 rr.tod = self.time + math.min(rr.ttl, 1); 507 rr.tod = self.time + math.max(rr.ttl, 1);
508 508
509 local remember = self.offset; 509 local remember = self.offset;
510 local rr_parser = self[dns.type[rr.type]]; 510 local rr_parser = self[dns.type[rr.type]];
511 if rr_parser then rr_parser(self, rr); end 511 if rr_parser then rr_parser(self, rr); end
512 self.offset = remember; 512 self.offset = remember;