stream: check for interruption when trying to reconnect stream

This happens with something like "mpv https://www.youtube.com/watch".
The URL is obviously not valid, but the stream layer tries to reconnect.
This commit at least allows to use the terminal to abort gracefully.
(Other than killing the process.)
This commit is contained in:
wm4 2013-06-06 20:39:55 +02:00
parent 6832bf3060
commit 7fefad7a8f
1 changed files with 3 additions and 3 deletions

View File

@ -298,10 +298,10 @@ static int stream_reconnect(stream_t *s)
int64_t pos = s->pos;
for (int retry = 0; retry < MAX_RECONNECT_RETRIES; retry++) {
mp_msg(MSGT_STREAM, MSGL_WARN,
"Connection lost! Attempting to reconnect...\n");
"Connection lost! Attempting to reconnect (%d)...\n", retry + 1);
if (retry)
mp_sleep_us(RECONNECT_SLEEP_MS * 1000);
if (stream_check_interrupt(retry ? RECONNECT_SLEEP_MS : 0))
return 0;
s->eof = 1;
stream_reset(s);