mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
media-session: don't loop forever on link failures
Based on patch from Pauli Virtanen Keep track of the last node that we failed to link to and don't try to link to it again over and over. See #882
This commit is contained in:
parent
fe49c2e6b1
commit
b54af4ab0a
1 changed files with 13 additions and 1 deletions
|
|
@ -98,6 +98,7 @@ struct node {
|
|||
struct spa_hook listener;
|
||||
|
||||
struct node *peer;
|
||||
struct node *failed_peer;
|
||||
|
||||
uint32_t client_id;
|
||||
int32_t priority;
|
||||
|
|
@ -483,6 +484,8 @@ static void session_remove(void *data, struct sm_object *object)
|
|||
spa_list_for_each(n, &impl->node_list, link) {
|
||||
if (n->peer == node)
|
||||
n->peer = NULL;
|
||||
if (n->failed_peer == node)
|
||||
n->failed_peer = NULL;
|
||||
}
|
||||
}
|
||||
sm_media_session_schedule_rescan(impl->session);
|
||||
|
|
@ -641,7 +644,10 @@ static int link_nodes(struct node *node, struct node *peer)
|
|||
res = sm_media_session_create_links(impl->session, &props->dict);
|
||||
if (res > 0) {
|
||||
node->peer = peer;
|
||||
node->failed_peer = NULL;
|
||||
node->connect_count++;
|
||||
} else {
|
||||
node->failed_peer = peer;
|
||||
}
|
||||
pw_properties_free(props);
|
||||
|
||||
|
|
@ -848,6 +854,12 @@ static int rescan_node(struct impl *impl, struct node *n)
|
|||
pw_log_debug(NAME" %p: linking to node '%d'", impl, peer->id);
|
||||
|
||||
do_link:
|
||||
if (peer == n->failed_peer) {
|
||||
/* Break rescan -> failed link -> rescan loop. */
|
||||
pw_log_debug(NAME" %p: tried to link '%d' on last rescan, not retrying",
|
||||
impl, peer->id);
|
||||
return 0;
|
||||
}
|
||||
link_nodes(n, peer);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue