impl-node: only do unprepare once

There is not reason to do the unprepare logic twice and it might
actually interfere with the actions of the client.

See #4840
Fixes #4893
This commit is contained in:
Wim Taymans 2025-09-15 10:22:16 +02:00
parent 3e574b314a
commit 24ab601201

View file

@ -225,17 +225,21 @@ do_node_unprepare(struct spa_loop *loop, bool async, uint32_t seq,
pw_log_trace("%p: unprepare %d remote:%d exported:%d", this, this->rt.prepared,
this->remote, this->exported);
/* We mark ourself as finished now, this will avoid going further into the process loop
* in case our fd was ready (removing ourselfs from the loop should avoid that as well).
* If we were supposed to be scheduled make sure we continue the graph for the peers we
* were supposed to trigger */
if (!this->rt.prepared)
return 0;
/* The remote client will INACTIVE itself and remove itself from the loop to avoid
* being scheduled.
* The server will mark remote nodes as FINISHED and trigger the peers. This will
* make sure the remote node will not trigger the peers anymore when it will
* stop (it only triggers peers when it has PENDING_TRIGGER (<= AWAKE)). We have
* to trigger the peers on the server because the client might simply be dead and
* not able to trigger anything.
*/
old_state = SPA_ATOMIC_XCHG(this->rt.target.activation->status, PW_NODE_ACTIVATION_INACTIVE);
if (PW_NODE_ACTIVATION_PENDING_TRIGGER(old_state))
trigger = get_time_ns(this->rt.target.system);
if (!this->rt.prepared)
return 0;
if (!this->remote)
spa_loop_remove_source(loop, &this->source);