diff options
-rwxr-xr-x | apt-panopticon.lua | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index ce44503..a5d94e2 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -294,10 +294,26 @@ checkHEAD = function (host, URL, r, retry, sanity) | |||
294 | checkHEAD(host, URL, r, retry + 1, sanity) | 294 | checkHEAD(host, URL, r, retry + 1, sanity) |
295 | return | 295 | return |
296 | end | 296 | end |
297 | local rfile, e = io.open("results/STATUS_" .. fname, "r") | 297 | local code = "???" |
298 | local code = "000" | ||
299 | local cstr = "" | 298 | local cstr = "" |
300 | local location = nil | 299 | local location = nil |
300 | local tmot = 1 | ||
301 | while not APT.checkFile('results/STATUS_' .. fname) do | ||
302 | I('Waiting for results/STATUS_' .. fname .. ' file.') | ||
303 | os.execute('sleep ' .. tmot) | ||
304 | tmot = tmot * 2 | ||
305 | if 8 < tmot then | ||
306 | if sanity then | ||
307 | T(" TIMEOUT " .. timeouts + 1 .. ", retry " .. retry + 1, PU.scheme, "URLSanity", host) | ||
308 | else | ||
309 | T(" TIMEOUT " .. timeouts + 1 .. ", retry " .. retry + 1, PU.scheme, "", host) | ||
310 | end | ||
311 | timeouts = timeouts + 1 | ||
312 | checkHEAD(host, URL, r, retry + 1, sanity) | ||
313 | return | ||
314 | end | ||
315 | end | ||
316 | local rfile, e = io.open("results/STATUS_" .. fname, "r") | ||
301 | if nil == rfile then W("opening results/STATUS_" .. fname .. " file - " .. e) else | 317 | if nil == rfile then W("opening results/STATUS_" .. fname .. " file - " .. e) else |
302 | for line in rfile:lines("*l") do | 318 | for line in rfile:lines("*l") do |
303 | if "#" == line:sub(1, 1) then | 319 | if "#" == line:sub(1, 1) then |
@@ -316,8 +332,8 @@ checkHEAD = function (host, URL, r, retry, sanity) | |||
316 | location = line:sub(11, -2) | 332 | location = line:sub(11, -2) |
317 | end | 333 | end |
318 | end | 334 | end |
335 | os.execute('rm -f results/STATUS_' .. fname .. ' 2>/dev/null') | ||
319 | end | 336 | end |
320 | os.execute('rm -f results/STATUS_' .. fname .. ' 2>/dev/null') | ||
321 | if ("4" == tostring(code):sub(1, 1)) or ("5" == tostring(code):sub(1, 1)) then | 337 | if ("4" == tostring(code):sub(1, 1)) or ("5" == tostring(code):sub(1, 1)) then |
322 | if sanity then | 338 | if sanity then |
323 | E(" " .. code .. " " .. cstr .. ". " .. check .. " " .. host .. " -> " .. URL, PU.scheme, "URLSanity", host) | 339 | E(" " .. code .. " " .. cstr .. ". " .. check .. " " .. host .. " -> " .. URL, PU.scheme, "URLSanity", host) |