diff --git a/download.lua b/download.lua index 4624f0b..9d32b89 100644 --- a/download.lua +++ b/download.lua @@ -66,7 +66,8 @@ end local function readc(con) local herr = false local data = "" - while not herr do + local lout = 0 + while ((not herr) and (lout < 50)) do try { function() local tmp = "" @@ -75,7 +76,11 @@ local function readc(con) if tmp ~= "" then data = data..tmp con:setTimeout(0) + else + lout = lout + 1 end + else + lout = lout + 1 end end, catch { @@ -85,6 +90,7 @@ local function readc(con) } } end + lout = 0 if data == "" then data = nil end diff --git a/upload.lua b/upload.lua index 2689edf..e2b19ef 100644 --- a/upload.lua +++ b/upload.lua @@ -60,33 +60,6 @@ function try(block) return result end -local function readc(con) - local herr = false - local data = "" - while not herr do - try { - function() - local tmp = "" - tmp = con:read(1) - if tmp ~= nil then - if tmp ~= "" then - data = data..tmp - end - end - end, - catch { - function(ex) - herr = true - end - } - } - end - if data == "" then - data = nil - end - return data -end - local function shandshake(con) print("Sending Handshake...\n") con:write("2")