aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticon.lua
diff options
context:
space:
mode:
authoronefang2020-01-01 22:42:30 +1000
committeronefang2020-01-01 22:42:30 +1000
commitd53d29a55605e291ab8a44c1a8e3d11aa0dd28ae (patch)
treef657150713df5e61cb29ae54a79100ef650a6300 /apt-panopticon.lua
parentCurl will try IPv4 as a backup if IPv6 fails, and we don't want that. (diff)
downloadapt-panopticon-d53d29a55605e291ab8a44c1a8e3d11aa0dd28ae.zip
apt-panopticon-d53d29a55605e291ab8a44c1a8e3d11aa0dd28ae.tar.gz
apt-panopticon-d53d29a55605e291ab8a44c1a8e3d11aa0dd28ae.tar.bz2
apt-panopticon-d53d29a55605e291ab8a44c1a8e3d11aa0dd28ae.tar.xz
Actually wait for the curl file before trying to process it.
Diffstat (limited to 'apt-panopticon.lua')
-rwxr-xr-xapt-panopticon.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua
index 057fc40..ba4d408 100755
--- a/apt-panopticon.lua
+++ b/apt-panopticon.lua
@@ -934,6 +934,14 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them.
934 end 934 end
935 D('*&gt;* Resumed coroutine NO LONGER waiting on - 0 < APT.checkExes(' .. downloadLock .. list.out .. '-' .. host .. '.log.txt') 935 D('*&gt;* Resumed coroutine NO LONGER waiting on - 0 < APT.checkExes(' .. downloadLock .. list.out .. '-' .. host .. '.log.txt')
936 936
937 -- Should not be needed, but maybe this is why sometimes I don't see the speeds, though the file is there when I look later.
938 local f = 'results/curl-' .. list.out .. "-" .. host .. ".log.txt"
939 while not APT.checkFile(f) do
940 D('*&lt;* About to yield coroutine while waiting on - not APT.checkFile(' .. f .. ')')
941 coroutine.yield()
942 D('*&gt;* Resumed coroutine while waiting on - not APT.checkFile(' .. f .. ')')
943 end
944
937--[[ TODO - should try to figure out which server the file actually got downloaded from, and attribute the speed and errors to that server. 945--[[ TODO - should try to figure out which server the file actually got downloaded from, and attribute the speed and errors to that server.
938 Which means parsing the curl logs, not just a simple match(). 946 Which means parsing the curl logs, not just a simple match().
939 Watch out for misplaced ^M, they don't all come at the end of the line. 947 Watch out for misplaced ^M, they don't all come at the end of the line.
@@ -944,8 +952,8 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them.
944 curl: (22) The requested URL returned error: 404 Not Found 952 curl: (22) The requested URL returned error: 404 Not Found
945]] 953]]
946 local min, max, spd = 999999999999, 0 954 local min, max, spd = 999999999999, 0
947 if APT.checkFile("results/curl-" .. list.out .. "-" .. host .. ".log.txt") then 955 if APT.checkFile(f) then
948 for l in io.lines("results/curl-" .. list.out .. "-" .. host .. ".log.txt") do 956 for l in io.lines(f) do
949 local speed, crrnt = l:match('^%c *%d+ +%d+k? +%d+ +%d+k? +%d+ +%d+ +(%d+k?) +%d+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +(%d+k?)') 957 local speed, crrnt = l:match('^%c *%d+ +%d+k? +%d+ +%d+k? +%d+ +%d+ +(%d+k?) +%d+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +(%d+k?)')
950 if nil ~= speed then 958 if nil ~= speed then
951 if 'k' == speed:sub(-1, -1) then speed = speed:sub(1, -2) .. '000' end 959 if 'k' == speed:sub(-1, -1) then speed = speed:sub(1, -2) .. '000' end