[vlc-commits] *.lua: handle recv() returning nil

Rafaël Carré git at videolan.org
Sun Jun 19 18:22:17 CEST 2011


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Sun Jun 19 12:21:48 2011 -0400| [fdcdeaa3da38b09860fa0d8e8398e27468660f19] | committer: Rafaël Carré

*.lua: handle recv() returning nil

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

 share/lua/intf/cli.lua          |    2 +-
 share/lua/intf/modules/host.lua |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
index 4662cbb..2663173 100644
--- a/share/lua/intf/cli.lua
+++ b/share/lua/intf/cli.lua
@@ -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
diff --git a/share/lua/intf/modules/host.lua b/share/lua/intf/modules/host.lua
index 9d42191..8b52e0b 100644
--- a/share/lua/intf/modules/host.lua
+++ b/share/lua/intf/modules/host.lua
@@ -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 )



More information about the vlc-commits mailing list