]> git.sesse.net Git - vlc/blobdiff - share/lua/intf/telnet.lua
Lua_telnet: if the telnet client program quit, close the connection correctly.
[vlc] / 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 == ""