Commit 1b76f4d5 authored by Pierre Ynard's avatar Pierre Ynard

luatelnet: fix input reading

This fixes problems with lost characters and failure to close
connections in some cases
parent 73e0e21f
...@@ -180,14 +180,14 @@ while not vlc.misc.should_die() do ...@@ -180,14 +180,14 @@ while not vlc.misc.should_die() do
-- Handle reads -- Handle reads
for _, client in pairs(r) do for _, client in pairs(r) do
local str = client.cmds .. client:recv(1000) local str = client:recv(1000)
if string.match(str,"\n") then if not str or str == "" -- the telnet client program has left
client.cmds = str
elseif not str or str == "" -- the telnet client program has left
or (client.type == host.client_type.net and str == "\004") then or (client.type == host.client_type.net and str == "\004") then
-- Caught a ^D -- Caught a ^D
client.cmds = "quit\n" client.cmds = "quit\n"
else
client.cmds = client.cmds .. str
end end
client.buffer = "" client.buffer = ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment