[vlc-commits] luatelnet: end remotely closed connections

Pierre Ynard git at videolan.org
Tue Feb 1 23:33:20 CET 2011


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Tue Feb  1 23:32:51 2011 +0100| [d16bdb968e2d1ef40e1cc109b79a4a0f3322b61f] | committer: Pierre Ynard

luatelnet: end remotely closed connections

Fix a busy loop and socket leak

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

 share/lua/intf/telnet.lua |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/share/lua/intf/telnet.lua b/share/lua/intf/telnet.lua
index 900e14e..c964bd2 100644
--- a/share/lua/intf/telnet.lua
+++ b/share/lua/intf/telnet.lua
@@ -183,13 +183,10 @@ while not vlc.misc.should_die() do
     for _, client in pairs(r) do
         local str = client.cmds .. client:recv(1000)
 
-        if not str then -- the telnet client program has left
-            client.cmds = "quit\n"
-        elseif string.match(str,"\n") then
+        if string.match(str,"\n") then
             client.cmds = str
-        elseif client.buffer == ""
-           and ((client.type == host.client_type.stdio and str == "")
-           or  (client.type == host.client_type.net and str == "\004")) then
+        elseif 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"
         end



More information about the vlc-commits mailing list