1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-22 11:17:40 +00:00

socket improvement

This commit is contained in:
kepler155c@gmail.com
2017-05-09 01:57:00 -04:00
parent ab73e3f2f9
commit f866d2bd58
10 changed files with 158 additions and 98 deletions

View File

@@ -40,7 +40,7 @@ local function telnetHost(socket, termInfo)
socket:close()
end)
local queueThread = process:newThread('telnet_read', function()
process:newThread('telnet_read', function()
while true do
local data = socket:read()
if not data then
@@ -49,7 +49,6 @@ local function telnetHost(socket, termInfo)
if data.type == 'shellRemote' then
local event = table.remove(data.event, 1)
shellThread:resume(event, unpack(data.event))
end
end
@@ -65,7 +64,10 @@ local function telnetHost(socket, termInfo)
break
end
if socket.queue then
socket:write(socket.queue)
if not socket:write(socket.queue) then
print('telnet: connection lost to ' .. socket.dhost)
break
end
socket.queue = nil
end
end