From 7fefad7a8f2e45fcab60b400a63c43097ad6c681 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 6 Jun 2013 20:39:55 +0200 Subject: 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.) --- stream/stream.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'stream/stream.c') diff --git a/stream/stream.c b/stream/stream.c index 5f45218383..d77ecfae6e 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -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); -- cgit v1.2.3