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.
This commit is contained in:
Pauli Virtanen 2022-11-03 19:22:20 +02:00 committed by George Kiagiadakis
parent 54f0ea710e
commit f79a330849

View file

@ -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 ()