Commit 525e092d authored by Pierre Ynard's avatar Pierre Ynard

lua: do delete stdin/stdout client

This fixes an endless loop when piping commands to stdin with echo
for example
parent ccaf5b8d
...@@ -125,14 +125,17 @@ function host() ...@@ -125,14 +125,17 @@ function host()
return vlc.win.console_read() return vlc.win.console_read()
end end
local function del_client( client, nostdioerror ) local function del_client( client )
--client:send("Cleaning up.\r\n") if not clients[client] then
if client.type == client_type.stdio then vlc.msg.err("couldn't find client to remove.")
if not nostdioerror then return
client:send( "Cannot delete stdin/stdout client.\n" )
end end
elseif clients[client] then
if client.type == client_type.net if client.type == client_type.stdio then
h:broadcast("Shutting down.\r\n")
vlc.msg.info("Requested shutdown.")
vlc.misc.quit()
elseif client.type == client_type.net
or client.type == client_type.telnet then or client.type == client_type.telnet then
if client.wfd ~= client.rfd then if client.wfd ~= client.rfd then
vlc.net.close( client.rfd ) vlc.net.close( client.rfd )
...@@ -140,9 +143,6 @@ function host() ...@@ -140,9 +143,6 @@ function host()
vlc.net.close( client.wfd ) vlc.net.close( client.wfd )
end end
clients[client] = nil clients[client] = nil
else
vlc.msg.err("couldn't find client to remove.")
end
end end
local function switch_status( client, s ) local function switch_status( client, s )
...@@ -318,7 +318,9 @@ function host() ...@@ -318,7 +318,9 @@ function host()
local function destructor( h ) local function destructor( h )
for _,client in pairs(clients) do for _,client in pairs(clients) do
client:del(true) if client.type ~= client_type.stdio then
client:del()
end
end end
end end
......
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