From 38114b6a36eecae7fa707d4d299ac5622cbe9928 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 29 Apr 2015 19:54:46 +0200 Subject: 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. --- stream/stream.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'stream') 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); -- cgit v1.2.3