[vlc-commits] lua: do delete stdin/stdout client

Pierre Ynard git at videolan.org
Sun Mar 18 04:09:24 CET 2012


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Mar 18 04:06:36 2012 +0100| [525e092dfd845b71af030fba2332ea961a4c2d37] | committer: Pierre Ynard

lua: do delete stdin/stdout client

This fixes an endless loop when piping commands to stdin with echo
for example

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=525e092dfd845b71af030fba2332ea961a4c2d37
---

 share/lua/intf/modules/host.lua |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/share/lua/intf/modules/host.lua b/share/lua/intf/modules/host.lua
index 0d299cb..0d345b8 100644
--- a/share/lua/intf/modules/host.lua
+++ b/share/lua/intf/modules/host.lua
@@ -125,24 +125,24 @@ function host()
         return vlc.win.console_read()
     end
 
-    local function del_client( client, nostdioerror )
-        --client:send("Cleaning up.\r\n")
+    local function del_client( client )
+        if not clients[client] then
+            vlc.msg.err("couldn't find client to remove.")
+            return
+        end
+
         if client.type == client_type.stdio then
-            if not nostdioerror then
-                client:send( "Cannot delete stdin/stdout client.\n" )
-            end
-        elseif clients[client] then
-            if client.type == client_type.net
-            or client.type == client_type.telnet then
-                if client.wfd ~= client.rfd then
-                    vlc.net.close( client.rfd )
-                end
-                vlc.net.close( client.wfd )
+            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
+            if client.wfd ~= client.rfd then
+                vlc.net.close( client.rfd )
             end
-            clients[client] = nil
-        else
-            vlc.msg.err("couldn't find client to remove.")
+            vlc.net.close( client.wfd )
         end
+        clients[client] = nil
     end
 
     local function switch_status( client, s )
@@ -318,7 +318,9 @@ function host()
 
     local function destructor( h )
         for _,client in pairs(clients) do
-            client:del(true)
+            if client.type ~= client_type.stdio then
+                client:del()
+            end
         end
     end
 



More information about the vlc-commits mailing list