diff options
-rwxr-xr-x | apt-panopticon.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index e1a481f..f81213c 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -265,15 +265,15 @@ checkHEAD = function (host, URL, r, retry) | |||
265 | os.execute("sleep " .. math.random(1, 4)) | 265 | os.execute("sleep " .. math.random(1, 4)) |
266 | check = "Retry " .. retry .. " " .. check | 266 | check = "Retry " .. retry .. " " .. check |
267 | end | 267 | end |
268 | if 3 < timeouts then | 268 | if 2 <= timeouts then |
269 | E("too many timeouts! " .. check .. " " .. host .. " -> " .. URL, PU.scheme, "", host) | 269 | E("too many timeouts! " .. check .. " " .. host .. " -> " .. URL, PU.scheme, "", host) |
270 | return | 270 | return |
271 | end | 271 | end |
272 | if 20 < r then | 272 | if 20 <= r then |
273 | E("too many redirects! " .. check .. " " .. host .. " -> " .. URL, PU.scheme, "", host) | 273 | E("too many redirects! " .. check .. " " .. host .. " -> " .. URL, PU.scheme, "", host) |
274 | return | 274 | return |
275 | end | 275 | end |
276 | if 4 < retry then | 276 | if 4 <= retry then |
277 | E("too many retries! " .. check .. " " .. host .. " -> " .. URL, PU.scheme, "", host) | 277 | E("too many retries! " .. check .. " " .. host .. " -> " .. URL, PU.scheme, "", host) |
278 | return | 278 | return |
279 | end | 279 | end |
@@ -348,19 +348,21 @@ local checkFiles = function (host, ip, path, file) | |||
348 | else | 348 | else |
349 | I(" Checking IP " .. host .. " -> " .. ip .. " " .. path) | 349 | I(" Checking IP " .. host .. " -> " .. ip .. " " .. path) |
350 | for i, s in pairs(referenceDevs) do | 350 | for i, s in pairs(referenceDevs) do |
351 | local t = timeouts; timeouts = 0 | ||
351 | if testing("http", host) then checkHEAD(host, "http://" .. ip .. path .. "/" .. s) end | 352 | if testing("http", host) then checkHEAD(host, "http://" .. ip .. path .. "/" .. s) end |
352 | if 3 < timeouts then return end | 353 | t = t + timeouts; timeouts = 0 |
353 | if testing("https", host) then checkHEAD(host, "https://" .. ip .. path .. "/" .. s) end | 354 | if testing("https", host) then checkHEAD(host, "https://" .. ip .. path .. "/" .. s) end |
354 | if 3 < timeouts then return end | 355 | if 4 <= (t + timeouts) then return end |
355 | end | 356 | end |
356 | 357 | ||
357 | for i, s in pairs(releases) do | 358 | for i, s in pairs(releases) do |
358 | for j, k in pairs(releaseFiles) do | 359 | for j, k in pairs(releaseFiles) do |
359 | if repoExists(s .. k) then | 360 | if repoExists(s .. k) then |
361 | local t = timeouts; timeouts = 0 | ||
360 | if testing("http", host) then checkHEAD(host, "http://" .. ip .. path .. "/merged/dists/" .. s .. k) end | 362 | if testing("http", host) then checkHEAD(host, "http://" .. ip .. path .. "/merged/dists/" .. s .. k) end |
361 | if 3 < timeouts then return end | 363 | t = t + timeouts; timeouts = 0 |
362 | if testing("https", host) then checkHEAD(host, "https://" .. ip .. path .. "/merged/dists/" .. s .. k) end | 364 | if testing("https", host) then checkHEAD(host, "https://" .. ip .. path .. "/merged/dists/" .. s .. k) end |
363 | if 3 < timeouts then return end | 365 | if 4 <= (t + timeouts) then return end |
364 | end | 366 | end |
365 | end | 367 | end |
366 | end | 368 | end |