Hi,

Currently liquidsoap crashes if at startup it can't connect. If it
gets disconnected it tries to reconnect, but if that fails, it
crashes. Your feature can be useful. In the future we may also
consider disconnecting (or streaming blank) when the _source_ fails
and thus support fallible sources -- this is in the TODO.

The patch is quite clean, but as Romain pointed out it affects the
behaviour of the whole system and not only of that output. It blocks
the whole output_start phase. Supposing output A has been started and
it takes 3 minutes to successfully start output B, we'll probably have
problems with A getting disconnected by shout because of the latency.
The change may also freeze the output thread if an output restarts
itself.

A possible way to do it: add an instance variable containing the time
of the last connection attempt. If an attempt fails, just update it.
At every output round (method send), if there is no connection, and
the previous attempt was long ago (say, 3 seconds) try to start the
output. This will be less violent, also the connection in the middle
of streaming might cause a little latency if the server doesn't
respond quickly... that's probably reasonable as a first
implementation. (By the way, better turn this off by default, of
course.)

Side remarks: the use of failure without more precision in the doc
makes me think about source failure and not connexion failure; also,
it'd be better not to catch all errors, but only, say "host not found"
and maybe "mount taken" (because "wrong password" is not
recoverable)...

Have fun.
-- 
David

Répondre à