From f79a330849ebf320c42d03c123f48fec6b9ad3a8 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Thu, 3 Nov 2022 19:22:20 +0200 Subject: [PATCH] scripts: policy-node: wait for unactivated links instead of removing If a link is not activated, don't remove it. Instead, schedule a rescan when a link activates, so that we'll handle it once it does. This is a workaround for some problems, see https://github.com/Audio4Linux/JDSP4Linux/issues/74 However, the underlying cause is not understood. --- src/scripts/policy-node.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/scripts/policy-node.lua b/src/scripts/policy-node.lua index 43df701c..a25d0a5e 100644 --- a/src/scripts/policy-node.lua +++ b/src/scripts/policy-node.lua @@ -123,6 +123,7 @@ function createLink (si, si_target, passthrough, exclusive) end Log.info (l, "activated si-standard-link") end + scheduleRescan() end) end @@ -696,9 +697,11 @@ function handleLinkable (si) if link ~= nil then -- remove old link if ((link:get_active_features() & Feature.SessionItem.ACTIVE) == 0) then - -- remove also not yet activated links: they might never become active, - -- and we should not loop waiting for them - Log.warning (link, "Link was not activated before removing") + -- Link not yet activated. We don't want to remove it now, as that + -- may cause problems. Instead, give up for now. A rescan is scheduled + -- once the link activates. + Log.info (link, "Link to be moved was not activated, will wait for it.") + return end si_flags[si_id].peer_id = nil link:remove () -- GitLab