daemon: fix load of studios with more than one room

The room link ports were searched by uuid gloablly.
When two rooms had same ports uuid, always the first one was found.
Then when setting the graph override uuid for port, the port
override uuid of the second room was set over the port of the first
room. Thus the first room port was getting wrong override uuid and the
second room port override uuid was never set.

The solution implemented is to search for the port within the already
found room client. Then set the override uuid for the found port.

Room client in the studio graph has uuid of the room and is created
when room is loaded. This ensures that later when room-link ports are
added, the port of the right room client will be found. Then the
override uuid will be set to the proper port.
This commit is contained in:
Nedko Arnaudov 2010-08-30 01:59:06 +03:00
parent 252fe2042c
commit dd822c7476
3 changed files with 54 additions and 8 deletions

View File

@ -356,15 +356,15 @@ static void callback_elstart(void * data, const char * el, const char ** attr)
}
/* room link port */
context_ptr->port = ladish_graph_find_port_by_uuid(g_studio.studio_graph, uuid2, false);
context_ptr->port = ladish_graph_find_client_port_by_uuid(g_studio.studio_graph, context_ptr->client, uuid2, false);
if (context_ptr->port == NULL)
{
log_error("room link port not found");
context_ptr->port = NULL;
context_ptr->error = XML_TRUE;
return;
}
ladish_graph_set_link_port_override_uuid(g_studio.studio_graph, uuid2, uuid);
ladish_graph_set_link_port_override_uuid(g_studio.studio_graph, context_ptr->port, uuid);
return;
}
}

View File

@ -106,6 +106,7 @@ static struct ladish_graph_port * ladish_graph_find_port_by_id_internal(struct l
static struct ladish_graph_port *
ladish_graph_find_port_by_uuid_internal(
struct ladish_graph * graph_ptr,
struct ladish_graph_client * client_ptr,
const uuid_t uuid,
bool use_link_override_uuids)
{
@ -124,6 +125,11 @@ ladish_graph_find_port_by_uuid_internal(
{
port_ptr = list_entry(node_ptr, struct ladish_graph_port, siblings_graph);
if (client_ptr != NULL && port_ptr->client_ptr != client_ptr)
{
continue;
}
#if defined(LOG_PORT_LOOKUP)
if (port_ptr->link)
{
@ -1685,7 +1691,7 @@ ladish_port_handle ladish_graph_find_port_by_uuid(ladish_graph_handle graph_hand
{
struct ladish_graph_port * port_ptr;
port_ptr = ladish_graph_find_port_by_uuid_internal(graph_ptr, uuid, use_link_override_uuids);
port_ptr = ladish_graph_find_port_by_uuid_internal(graph_ptr, NULL, uuid, use_link_override_uuids);
if (port_ptr != NULL)
{
return port_ptr->port;
@ -2085,12 +2091,39 @@ const char * ladish_graph_get_port_name(ladish_graph_handle graph_handle, ladish
return port_ptr->name;
}
void ladish_graph_set_link_port_override_uuid(ladish_graph_handle graph_handle, const uuid_t uuid, const uuid_t override_uuid)
ladish_port_handle
ladish_graph_find_client_port_by_uuid(
ladish_graph_handle graph_handle,
ladish_client_handle client,
const uuid_t uuid,
bool use_link_override_uuids)
{
struct ladish_graph_client * client_ptr;
struct ladish_graph_port * port_ptr;
client_ptr = ladish_graph_find_client(graph_ptr, client);
ASSERT(client_ptr != NULL);
port_ptr = ladish_graph_find_port_by_uuid_internal(graph_ptr, client_ptr, uuid, use_link_override_uuids);
if (port_ptr != NULL)
{
return port_ptr->port;
}
return NULL;
}
void
ladish_graph_set_link_port_override_uuid(
ladish_graph_handle graph_handle,
ladish_port_handle port,
const uuid_t override_uuid)
{
struct ladish_graph_port * port_ptr;
port_ptr = ladish_graph_find_port_by_uuid_internal(graph_ptr, uuid, false);
port_ptr = ladish_graph_find_port(graph_ptr, port);
ASSERT(ladish_port_is_link(port_ptr->port));
uuid_copy(port_ptr->link_uuid_override, override_uuid);
}

View File

@ -144,6 +144,20 @@ ladish_client_handle ladish_graph_find_client_by_app(ladish_graph_handle graph_h
ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name);
ladish_client_handle ladish_graph_find_client_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid);
ladish_port_handle ladish_graph_find_port_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid, bool use_link_override_uuids);
ladish_port_handle
ladish_graph_find_client_port_by_uuid(
ladish_graph_handle graph,
ladish_client_handle client,
const uuid_t uuid,
bool use_link_override_uuids);
void
ladish_graph_set_link_port_override_uuid(
ladish_graph_handle graph,
ladish_port_handle port,
const uuid_t override_uuid);
ladish_client_handle ladish_graph_get_port_client(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
const char * ladish_graph_get_client_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
const char * ladish_graph_get_port_name(ladish_graph_handle graph, ladish_port_handle port);
@ -160,7 +174,6 @@ void ladish_graph_show_connection(ladish_graph_handle graph_handle, uint64_t con
void ladish_try_connect_hidden_connections(ladish_graph_handle graph_handle);
void ladish_graph_hide_non_virtual(ladish_graph_handle graph_handle);
void ladish_graph_get_port_uuid(ladish_graph_handle graph, ladish_port_handle port, uuid_t uuid_ptr);
void ladish_graph_set_link_port_override_uuid(ladish_graph_handle graph_handle, const uuid_t uuid, const uuid_t override_uuid);
void ladish_graph_dump(ladish_graph_handle graph_handle);