diff --git a/vtunnel/service/vtunnel.lua b/vtunnel/service/vtunnel.lua index f34c0ef..27a5193 100644 --- a/vtunnel/service/vtunnel.lua +++ b/vtunnel/service/vtunnel.lua @@ -102,6 +102,18 @@ function start() os.kill(v) end end + return os.spawn(function() + local last = computer.uptime() + while true do + local tE = {coroutine.yield()} + if computer.uptime() > last + cfg.rtimer then + for k,v in pairs(proxies) do + v.read() + end + last = computer.uptime() + end + end + end,"vtunnel") end function vt.stop() for k,v in pairs(proxies) do @@ -147,16 +159,6 @@ function vt.settimer(time) end vt.start = start -_G.libs.vtunnel = vt +package.loaded.vtunnel = vt -start() -local last = computer.uptime() -while true do - local tE = {coroutine.yield()} - if computer.uptime() > last + cfg.rtimer then - for k,v in pairs(proxies) do - v.read() - end - last = computer.uptime() - end -end +return vt