[vlc] lua telnet controller requires waiting between sending lines

Ed Groth ed at boxpopu.li
Wed Jul 7 19:51:21 CEST 2010


On Tue, Jul 6, 2010 at 11:56 PM, Rémi Duraffort <ivoire at videolan.org> wrote:
> 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.
> This is normally fixed by
> (http://git.videolan.org/?p=vlc.git;a=commitdiff;h=f5b8b43a9e210a70e016871db6bab36929d6b866;hp=ec87e89b5950679bb48b714ebffd2ae7040b999b)
>
> You can try the new lua script from the git.

This works much better, thank you.  However sometimes it will lose a
single character out of the buffer which may result in truncated
command.  We wouldn't notice except we sometimes send an entire vlm
configuration over telnet.

(perl -e 'print "admin\n" . " " x 991 . "show\n"'; sleep 1; echo quit)
| nc localhost 4212

sho : Unknown command

I have changed the line

    local str = string.gsub(client:recv(1000),"\r","\n")

to

    local str = string.gsub(client:recv(1),"\r","\n")

and it works fine, but perhaps there is a better way?

>
>
> Best regards
>
> --
> Rémi Duraffort | ivoire
>

  Ed



More information about the vlc mailing list