[vlc-commits] luatelnet: fix input reading

Pierre Ynard git at videolan.org
Sat Mar 12 17:55:35 CET 2011


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Mar 12 17:54:11 2011 +0100| [1b76f4d5b6e247ebc1f3f1786c99eef1f0510c73] | committer: Pierre Ynard

luatelnet: fix input reading

This fixes problems with lost characters and failure to close
connections in some cases

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

 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 2a87d5d..759f256 100644
--- a/share/lua/intf/telnet.lua
+++ b/share/lua/intf/telnet.lua
@@ -180,14 +180,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