Software /
code /
prosody
Comparison
net/dns.lua @ 1823:7c3ec7ac6316
Merge with 0.5
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 24 Sep 2009 23:47:16 +0100 |
parent | 1816:1c0bde3db7d8 |
parent | 1822:2f78ea5d0f11 |
child | 1836:f4c88dd32724 |
comparison
equal
deleted
inserted
replaced
1819:ed1911be26c7 | 1823:7c3ec7ac6316 |
---|---|
93 for i,rr in pairs (rrs) do | 93 for i,rr in pairs (rrs) do |
94 | 94 |
95 if rr.tod then | 95 if rr.tod then |
96 -- rr.tod = rr.tod - 50 -- accelerated decripitude | 96 -- rr.tod = rr.tod - 50 -- accelerated decripitude |
97 rr.ttl = math.floor (rr.tod - time) | 97 rr.ttl = math.floor (rr.tod - time) |
98 if rr.ttl <= 0 then rrs[i] = nil end | 98 if rr.ttl <= 0 then |
99 table.remove(rrs, i); | |
100 return prune(rrs, time, soft); -- Re-iterate | |
101 end | |
99 | 102 |
100 elseif soft == 'soft' then -- What is this? I forget! | 103 elseif soft == 'soft' then -- What is this? I forget! |
101 assert (rr.ttl == 0) | 104 assert (rr.ttl == 0) |
102 rrs[i] = nil | 105 rrs[i] = nil |
103 end end end | 106 end end end |
505 | 508 |
506 function resolver:adddefaultnameservers () -- - - - - adddefaultnameservers | 509 function resolver:adddefaultnameservers () -- - - - - adddefaultnameservers |
507 local resolv_conf = io.open("/etc/resolv.conf"); | 510 local resolv_conf = io.open("/etc/resolv.conf"); |
508 if resolv_conf then | 511 if resolv_conf then |
509 for line in resolv_conf:lines() do | 512 for line in resolv_conf:lines() do |
510 local address = string.match (line, '^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)') | 513 local address = string.match (line, '^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$') |
511 if address then self:addnameserver (address) end | 514 if address then self:addnameserver (address) end |
512 end | 515 end |
513 elseif os.getenv("WINDIR") then | 516 elseif os.getenv("WINDIR") then |
514 self:addnameserver ("208.67.222.222") | 517 self:addnameserver ("208.67.222.222") |
515 self:addnameserver ("208.67.220.220") | 518 self:addnameserver ("208.67.220.220") |