Commit fdcdeaa3 authored by Rafaël Carré's avatar Rafaël Carré

*.lua: handle recv() returning nil

parent f52a83cc
......@@ -787,7 +787,7 @@ while not vlc.misc.should_die() do
for _, client in pairs(read) do
local input = client:recv(1000)
if input == nil or input == "" -- the telnet client program has left
if input == nil -- the telnet client program has left
or ((client.type == host.client_type.net
or client.type == host.client_type.telnet)
and input == "\004") then
......
......@@ -52,6 +52,7 @@ Example use:
-- handle clients in read mode
for _, client in pairs(read) do
local str = client:recv(1000)
if not str then break end
str = string.gsub(str,"\r?\n$","")
client.buffer = "Got `"..str.."'.\r\n"
client:switch_status( host.status.write )
......
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