summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5ea2e99)
raw | patch | inline | side by side (parent: 5ea2e99)
author | Max Kellermann <max@duempel.org> | |
Sat, 3 Oct 2009 23:10:26 +0000 (01:10 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sat, 3 Oct 2009 23:10:26 +0000 (01:10 +0200) |
Every GLib event callback which may affect the connection should
detect a lost connection.
detect a lost connection.
src/main.c | patch | blob | history |
diff --git a/src/main.c b/src/main.c
index d10e42abedc37b73e9df83909171cc9ed13e589b..726f098f3d046414dfcd88b1930b6e8c07b67134 100644 (file)
--- a/src/main.c
+++ b/src/main.c
return FALSE;
}
+static void
+check_reconnect(void)
+{
+ 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);
+}
+
static gboolean
timer_mpd_update(gpointer data)
{
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);
+ check_reconnect();
return GPOINTER_TO_INT(data);
}
{
screen_update(mpd);
mpd->events = 0;
+
+ check_reconnect();
}
int do_input_event(command_t cmd)