summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-29 19:54:46 +0200
committerwm4 <wm4@nowhere>2015-04-29 19:54:46 +0200
commit38114b6a36eecae7fa707d4d299ac5622cbe9928 (patch)
treec1575cafdc108045383e4725a9a12dfee520369c /stream
parentdaf4334697145f771c5085fb183e64dc65a967bd (diff)
downloadmpv-38114b6a36eecae7fa707d4d299ac5622cbe9928.tar.bz2
mpv-38114b6a36eecae7fa707d4d299ac5622cbe9928.tar.xz
stream: don't print reconnection message if no stream support
This code does not know whether the stream supports reconnecting until STREAM_CTRL_RECONNECT is called. So the message should be printed after it. To avoid that reconnects that succeed on the first try go unnoticed, print a warning on success.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 9456ad1251..cfdf67be14 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -401,13 +401,15 @@ static bool stream_reconnect(stream_t *s)
if (mp_cancel_wait(s->cancel, sleep_secs))
break;
- MP_WARN(s, "Connection lost! Attempting to reconnect (%d)...\n", retry + 1);
-
int r = stream_control(s, STREAM_CTRL_RECONNECT, NULL);
if (r == STREAM_UNSUPPORTED)
break;
- if (r == STREAM_OK && stream_seek_unbuffered(s, pos) && s->pos == pos)
+ if (r == STREAM_OK && stream_seek_unbuffered(s, pos) && s->pos == pos) {
+ MP_WARN(s, "Reconnected successfully.\n");
return true;
+ }
+
+ MP_WARN(s, "Connection lost! Attempting to reconnect (%d)...\n", retry + 1);
sleep_secs = MPMAX(sleep_secs, 0.1);
sleep_secs = MPMIN(sleep_secs * 4, 10.0);