diff options
author | wm4 <wm4@nowhere> | 2013-06-06 20:39:55 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-16 22:05:09 +0200 |
commit | 7fefad7a8f2e45fcab60b400a63c43097ad6c681 (patch) | |
tree | 19d36cec037e597d52740d5bd5dcda5555fc15f1 | |
parent | 6832bf3060dc19d876e4f9d6e653f69a24651b96 (diff) | |
download | mpv-7fefad7a8f2e45fcab60b400a63c43097ad6c681.tar.bz2 mpv-7fefad7a8f2e45fcab60b400a63c43097ad6c681.tar.xz |
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.)
-rw-r--r-- | stream/stream.c | 6 |
1 files changed, 3 insertions, 3 deletions
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); |