]> git.sesse.net Git - vlc/commitdiff
Lua_telnet: if the telnet client program quit, close the connection correctly.
authorRémi Duraffort <ivoire@videolan.org>
Thu, 1 Apr 2010 20:26:43 +0000 (22:26 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Thu, 1 Apr 2010 20:27:51 +0000 (22:27 +0200)
share/lua/intf/telnet.lua

index a529b07ef52d8a0bbd7e5f7fa703ab1c6c0ed7c5..89a478669ca50ccc74e19ea5b9f90f7b4c4d5243 100644 (file)
@@ -185,7 +185,10 @@ while not vlc.misc.should_die() do
     for _, client in pairs(r) do
         local str = client:recv(1000)
         local done = false
-        if string.match(str,"\n$") then
+        if not str then -- the telnet client program has leave
+            client.buffer = "quit"
+            done = true
+        elseif string.match(str,"\n$") then
             client.buffer = string.gsub(client.buffer..str,"\r?\n$","")
             done = true
         elseif client.buffer == ""