From 01df67ceb63ba69a981e70d67a3c216aa596c0d0 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Thu, 30 Sep 2010 19:08:43 +0200 Subject: [PATCH] Move last_active check into the device add case --- src/player.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/player.c b/src/player.c index 2505aed0..b75cc9ef 100644 --- a/src/player.c +++ b/src/player.c @@ -2916,22 +2916,6 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha DPRINTF(E_DBG, L_PLAYER, "Found AirTunes device %" PRIx64 "/%s (%d)\n", id, at_name, port); - /* Check if the device was selected last time */ - if (time(NULL) < dev_deadline) - { - player_get_status(&status); - - if (status.status != PLAY_STOPPED) - last_active = 0; - else - { - ret = db_config_has_tuple_hex64(VAR_ACTIVE_SPK, id); - last_active = (ret == 1); - } - } - else - last_active = 0; - if (port < 0) { /* Device stopped advertising */ @@ -3071,6 +3055,22 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha encrypt = 0; no_am: + /* Check if the device was selected last time */ + if (time(NULL) < dev_deadline) + { + player_get_status(&status); + + if (status.status != PLAY_STOPPED) + last_active = 0; + else + { + ret = db_config_has_tuple_hex64(VAR_ACTIVE_SPK, id); + last_active = (ret == 1); + } + } + else + last_active = 0; + pthread_mutex_lock(&dev_lck); for (rd = dev_list; rd; rd = rd->next)