summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9ed301c)
raw | patch | inline | side by side (parent: 9ed301c)
author | Max Kellermann <max@duempel.org> | |
Sat, 3 Oct 2009 23:10:23 +0000 (01:10 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sat, 3 Oct 2009 23:10:23 +0000 (01:10 +0200) |
During timer_mpd_update(), the MPD connection may get lost. Move that
reconnect test to the end of timer_mpd_update(), so we can catch it as
soon as possible. There is no advantage in having it at the
beginning.
reconnect test to the end of timer_mpd_update(), so we can catch it as
soon as possible. There is no advantage in having it at the
beginning.
src/main.c | patch | blob | history |
diff --git a/src/main.c b/src/main.c
index f874d6292dd573df994fcaed33485dda20f585b8..d10e42abedc37b73e9df83909171cc9ed13e589b 100644 (file)
--- a/src/main.c
+++ b/src/main.c
{
if (mpdclient_is_connected(mpd))
mpdclient_update(mpd);
- else if (reconnect_source_id == 0)
- reconnect_source_id = g_timeout_add(1000, timer_reconnect,
- NULL);
#ifndef NCMPC_MINI
if (options.enable_xterm_title)
screen_update(mpd);
mpd->events = 0;
+ if (!mpdclient_is_connected(mpd) && reconnect_source_id == 0)
+ /* reconnect when the connection is lost */
+ reconnect_source_id = g_timeout_add(1000, timer_reconnect,
+ NULL);
+
return GPOINTER_TO_INT(data);
}