55 lines
2.0 KiB
Diff
55 lines
2.0 KiB
Diff
From 37c839b9308cd3d6580bf01077db8cb29ec2aa2f Mon Sep 17 00:00:00 2001
|
|
From: Pauli Virtanen <pav@iki.fi>
|
|
Date: Tue, 19 Jul 2022 20:39:06 +0300
|
|
Subject: [PATCH] policy-node: fix potential rescan loop
|
|
|
|
SiLink activation might be delayed indefinitely under some error
|
|
conditions. Currently, policy-node schedules a rescan when it sees a
|
|
non-activated link on a stream to be moved, which produces busy loop if
|
|
the si-link doesn't activate.
|
|
|
|
Instead of rescheduling on non-active si-links, just remove and emit a
|
|
warning. The si-link then gets removed once it gets activated.
|
|
|
|
Reproducer:
|
|
|
|
1. Play audio from Rhythmbox and pause.
|
|
2. Switch default output with pactl between two different outputs
|
|
3. Links from the paused stream stay at "init"
|
|
---
|
|
src/scripts/policy-node.lua | 17 ++++++++---------
|
|
1 file changed, 8 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/src/scripts/policy-node.lua b/src/scripts/policy-node.lua
|
|
index e6816723..43df701c 100644
|
|
--- a/src/scripts/policy-node.lua
|
|
+++ b/src/scripts/policy-node.lua
|
|
@@ -694,16 +694,15 @@ function handleLinkable (si)
|
|
local link = lookupLink (si_id, si_flags[si_id].peer_id)
|
|
if reconnect then
|
|
if link ~= nil then
|
|
- -- remove old link if active, otherwise schedule rescan
|
|
- if ((link:get_active_features() & Feature.SessionItem.ACTIVE) ~= 0) then
|
|
- si_flags[si_id].peer_id = nil
|
|
- link:remove ()
|
|
- Log.info (si, "... moving to new target")
|
|
- else
|
|
- scheduleRescan()
|
|
- Log.info (si, "... scheduled rescan")
|
|
- return
|
|
+ -- 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")
|
|
end
|
|
+ si_flags[si_id].peer_id = nil
|
|
+ link:remove ()
|
|
+ Log.info (si, "... moving to new target")
|
|
end
|
|
else
|
|
if link ~= nil then
|
|
--
|
|
GitLab
|
|
|