[vlc-commits] luatelnet: end remotely closed connections

Pierre Ynard git at videolan.org
Wed Feb 2 00:56:31 CET 2011


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

luatelnet: end remotely closed connections

Fix a busy loop and socket leak
(cherry picked from commit d16bdb968e2d1ef40e1cc109b79a4a0f3322b61f)

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

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

 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