From 55d0e2622a24111abc47924c29939a92cc2a0386 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 23 Aug 2011 18:07:33 +0200 Subject: [PATCH] mpdclient: pass integer timeout to mpdclient_connect() Use milliseconds instead of float seconds. Reduces overhead. --- src/main.c | 2 +- src/mpdclient.c | 4 ++-- src/mpdclient.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 25321fc..15663df 100644 --- a/src/main.c +++ b/src/main.c @@ -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 */ diff --git a/src/mpdclient.c b/src/mpdclient.c index 59b0ad4..4882d54 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -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"); diff --git a/src/mpdclient.h b/src/mpdclient.h index 383634f..798e979 100644 --- a/src/mpdclient.h +++ b/src/mpdclient.h @@ -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); -- 2.30.2