Code

mpdclient: pass integer timeout to mpdclient_connect()
authorMax Kellermann <max@duempel.org>
Tue, 23 Aug 2011 16:07:33 +0000 (18:07 +0200)
committerMax Kellermann <max@duempel.org>
Tue, 23 Aug 2011 16:07:33 +0000 (18:07 +0200)
Use milliseconds instead of float seconds.  Reduces overhead.

src/main.c
src/mpdclient.c
src/mpdclient.h

index 25321fc4229a3fbd01ea19bd07f7a1ed09749142..15663df0c9db14facfde74ddd2771319c26ce59e 100644 (file)
@@ -318,7 +318,7 @@ timer_reconnect(G_GNUC_UNUSED gpointer data)
        mpdclient_disconnect(mpd);
        success = mpdclient_connect(mpd,
                                    options.host, options.port,
-                                   1.5,
+                                   1500,
                                    options.password);
        if (!success) {
                /* try again in 5 seconds */
index 59b0ad45ff504c8c47959e708220747b2b50b907..4882d548f1b21563112626f59bfd7489134d8429 100644 (file)
@@ -145,7 +145,7 @@ bool
 mpdclient_connect(struct mpdclient *c,
                  const gchar *host,
                  gint port,
-                 gfloat _timeout,
+                 unsigned timeout_ms,
                  const gchar *password)
 {
        /* close any open connection */
@@ -153,7 +153,7 @@ mpdclient_connect(struct mpdclient *c,
                mpdclient_disconnect(c);
 
        /* connect to MPD */
-       c->connection = mpd_connection_new(host, port, _timeout * 1000);
+       c->connection = mpd_connection_new(host, port, timeout_ms);
        if (c->connection == NULL)
                g_error("Out of memory");
 
index 383634fb78398c2e10726ca88d3acc7f03e4cb19..798e979c4d2bbcf73f006282b944627e71c97794 100644 (file)
@@ -76,7 +76,7 @@ mpdclient_get_current_song(const struct mpdclient *c)
 
 bool
 mpdclient_connect(struct mpdclient *c, const gchar *host, gint port,
-                 gfloat timeout_, const gchar *password);
+                 unsigned timeout_ms, const gchar *password);
 
 void
 mpdclient_disconnect(struct mpdclient *c);