[vlc] lua telnet controller requires waiting between sending lines

Ed Groth ed at boxpopu.li
Wed Jun 30 20:52:57 CEST 2010


Hello,

I've noticed that the lua telnet controller in 1.1.0 and newer will
fail if you send multiple lines at the same time.

To reproduce, run "vlc -I telnet" in the background.

"( echo admin; echo show ) | nc localhost 4212" fails.

"( echo admin; sleep 1; echo show ) | nc localhost 4212" succeeds.

I don't know lua, but it looks like the cause may be in the main loop
around line 186 of share/lua/intf/telnet.lua where it tries to read
1000 bytes, then removes the newline at the end of the string.  It
looks like it reads everything the client has sent so far, regardless
of how many lines are contained in the "str" buffer.  Is it possible
to "recv" only complete lines a la fgets()?

If not, another approach might be to append each input str into a
command buffer kept for each client, and then once the command buffer
contains a string with a newline, remove the part up to the newline
and parse it as a command .

  Ed



More information about the vlc mailing list