[vlc-commits] luatelnet: fix input reading

Pierre Ynard git at videolan.org
Sat Mar 12 17:59:41 CET 2011


vlc/vlc-1.1 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Mar 12 17:54:11 2011 +0100| [8f47014f7707602f07c84ceed5a28df1e9f21620] | committer: Pierre Ynard

luatelnet: fix input reading

This fixes problems with lost characters and failure to close
connections in some cases
(cherry picked from commit 1b76f4d5b6e247ebc1f3f1786c99eef1f0510c73)

Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

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

 share/lua/intf/telnet.lua |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/share/lua/intf/telnet.lua b/share/lua/intf/telnet.lua
index 5a0d315..7adb317 100644
--- a/share/lua/intf/telnet.lua
+++ b/share/lua/intf/telnet.lua
@@ -181,14 +181,14 @@ while not vlc.misc.should_die() do
 
     -- Handle reads
     for _, client in pairs(r) do
-        local str = client.cmds .. client:recv(1000)
+        local str = client:recv(1000)
 
-        if string.match(str,"\n") then
-            client.cmds = str
-        elseif not str or str == "" -- the telnet client program has left
+        if not str or str == "" -- the telnet client program has left
            or  (client.type == host.client_type.net and str == "\004") then
             -- Caught a ^D
             client.cmds = "quit\n"
+        else
+            client.cmds = client.cmds .. str
         end
 
         client.buffer = ""



More information about the vlc-commits mailing list