mirror of
https://github.com/ShadowKatStudios/OC-Minitel.git
synced 2024-11-23 10:38:05 +11:00
made vtunnel clean up after itself better, hopefully
This commit is contained in:
parent
c63506ec8b
commit
48cf9ffee1
@ -8,6 +8,7 @@ local internet = component.internet
|
|||||||
local addr, raddr = vcomp.uuid(),vcomp.uuid()
|
local addr, raddr = vcomp.uuid(),vcomp.uuid()
|
||||||
local poll = 0.5
|
local poll = 0.5
|
||||||
local listener, timer
|
local listener, timer
|
||||||
|
local socket
|
||||||
|
|
||||||
-- dumb keepalive stuff
|
-- dumb keepalive stuff
|
||||||
local keepalive = 30
|
local keepalive = 30
|
||||||
@ -16,7 +17,7 @@ local katimer
|
|||||||
function start(iaddr,port)
|
function start(iaddr,port)
|
||||||
if listener then return end
|
if listener then return end
|
||||||
iaddr,port = iaddr or "shadowkat.net", tonumber(port) or 4096
|
iaddr,port = iaddr or "shadowkat.net", tonumber(port) or 4096
|
||||||
local socket = internet.connect(iaddr,port)
|
socket = internet.connect(iaddr,port)
|
||||||
print("Connecting to "..iaddr..":"..tostring(port).."...")
|
print("Connecting to "..iaddr..":"..tostring(port).."...")
|
||||||
repeat
|
repeat
|
||||||
os.sleep(0.5)
|
os.sleep(0.5)
|
||||||
@ -73,7 +74,12 @@ function stop()
|
|||||||
event.cancel(timer)
|
event.cancel(timer)
|
||||||
timer = nil
|
timer = nil
|
||||||
end
|
end
|
||||||
if component.type(addr) then
|
if katimer then
|
||||||
vcomp.unregister(addr)
|
event.cancel(katimer)
|
||||||
|
katimer = nil
|
||||||
end
|
end
|
||||||
|
if component.type(addr) then
|
||||||
|
vcomp.unregister(addr)
|
||||||
|
end
|
||||||
|
socket.close()
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user