[vlc-commits] commit: Lua_telnet: if the telnet client program quit, close the connection correctly. ( Rémi Duraffort )

git at videolan.org git at videolan.org
Thu Apr 1 22:28:00 CEST 2010


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Thu Apr  1 22:26:43 2010 +0200| [52b39f923deb31a758f3ed8f485bfa9ba075aa97] | committer: Rémi Duraffort 

Lua_telnet: if the telnet client program quit, close the connection correctly.

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

 share/lua/intf/telnet.lua |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/share/lua/intf/telnet.lua b/share/lua/intf/telnet.lua
index a529b07..89a4786 100644
--- a/share/lua/intf/telnet.lua
+++ b/share/lua/intf/telnet.lua
@@ -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 == ""



More information about the vlc-commits mailing list