commit 97e55bd632212da6432ab1d6c00bb5f97604abe4
parent f73613f6c56516c7a3f36cc4e23b1861e563ff7d
Author: sin <sin@2f30.org>
Date: Mon, 26 Sep 2016 16:35:37 +0100
Don't free connection if no song is playing, just reuse it
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/spoon.c b/spoon.c
@@ -58,10 +58,9 @@ mpdread(char *buf, size_t len)
}
mpd_send_current_song(conn);
song = mpd_recv_song(conn);
- if (song == NULL) {
- ret = -1;
- goto out;
- }
+ /* if no song is playing, reuse connection next time */
+ if (song == NULL)
+ return -1;
artist = mpd_song_get_tag(song, MPD_TAG_ARTIST, 0);
title = mpd_song_get_tag(song, MPD_TAG_TITLE, 0);
if (artist != NULL && title != NULL) {