Code

increment version number to 0.27
[ncmpc.git] / src / main.c
index c242da922e97e715ac88a27856f51d04e042c1a9..5b906c513173385869779869c19f07f2b02784f9 100644 (file)
@@ -130,9 +130,6 @@ auto_update_timer(void)
                disable_update_timer();
 }
 
-static void
-check_reconnect(void);
-
 static void
 do_mpd_update(void)
 {
@@ -147,9 +144,6 @@ do_mpd_update(void)
 
        screen_update(mpd);
        mpd->events = 0;
-
-       mpdclient_put_connection(mpd);
-       check_reconnect();
 }
 
 static char *
@@ -201,23 +195,11 @@ timer_reconnect(gcc_unused gpointer data)
        g_free(name);
        doupdate();
 
-       mpdclient_disconnect(mpd);
-       mpdclient_connect(mpd, options.host, options.port,
-                         options.timeout_ms,
-                         options.password);
+       mpdclient_connect(mpd);
 
        return FALSE;
 }
 
-static void
-check_reconnect(void)
-{
-       if (mpdclient_is_dead(mpd) && reconnect_source_id == 0)
-               /* reconnect when the connection is lost */
-               reconnect_source_id = g_timeout_add(1000, timer_reconnect,
-                                                   NULL);
-}
-
 void
 mpdclient_connected_callback(void)
 {
@@ -311,8 +293,6 @@ void end_input_event(void)
        screen_update(mpd);
        mpd->events = 0;
 
-       mpdclient_put_connection(mpd);
-       check_reconnect();
        auto_update_timer();
 }
 
@@ -423,7 +403,9 @@ main(int argc, const char *argv[])
 #endif
 
        /* create mpdclient instance */
-       mpd = mpdclient_new();
+       mpd = mpdclient_new(options.host, options.port,
+                           options.timeout_ms,
+                           options.password);
 
        /* initialize curses */
        screen_init(mpd);