summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-29 19:54:46 +0200
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-05-07 10:39:47 +0900
commit5f4e4ede895509a0c563a927932a0a908c8dafd1 (patch)
treea6b18be20148b275cb104edd79900ad458808c56
parent4a6fdb7361e2f03f3879268bc9e7328637fc1720 (diff)
downloadmpv-5f4e4ede895509a0c563a927932a0a908c8dafd1.tar.bz2
mpv-5f4e4ede895509a0c563a927932a0a908c8dafd1.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. (cherry picked from commit 38114b6a36eecae7fa707d4d299ac5622cbe9928)
-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);