]> git.sesse.net Git - vlc/commitdiff
lua: finish reading data from hung up client before deleting it
authorPierre Ynard <linkfanel@yahoo.fr>
Sat, 17 Mar 2012 21:36:31 +0000 (22:36 +0100)
committerPierre Ynard <linkfanel@yahoo.fr>
Sat, 17 Mar 2012 21:36:31 +0000 (22:36 +0100)
In particular this happens when piping commands into stdin

share/lua/intf/modules/host.lua

index b0332c6e63c95c1931390eff90bdafcc297e7233..0d299cbfe0e33e46af81049002dabf89b4ca47ea 100644 (file)
@@ -278,14 +278,14 @@ function host()
             local ret = vlc.net.poll( pollfds )
             if ret > 0 then
                 for _, client in pairs(clients) do
-                    if is_flag_set(pollfds[client:fd()], vlc.net.POLLERR)
+                    if is_flag_set(pollfds[client:fd()], vlc.net.POLLIN) then
+                        table.insert(rclients, client)
+                    elseif is_flag_set(pollfds[client:fd()], vlc.net.POLLERR)
                     or is_flag_set(pollfds[client:fd()], vlc.net.POLLHUP)
                     or is_flag_set(pollfds[client:fd()], vlc.net.POLLNVAL) then
                         client:del()
                     elseif is_flag_set(pollfds[client:fd()], vlc.net.POLLOUT) then
                         table.insert(wclients, client)
-                    elseif is_flag_set(pollfds[client:fd()], vlc.net.POLLIN) then
-                        table.insert(rclients, client)
                     end
                 end
                 if listeners.tcp then