From 1b669324595e17daee8b9f666db65cc408757727 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Mon, 1 Nov 2010 21:28:28 +0200 Subject: [PATCH] ladishd: properly detect connect failures This fixes a bug when port is appearing, connect attempt is made, connect fails because port has just disappeared, port reappears then but new connect attempt was not made. Happens quite easily with wineasio apps that "probe" (nuendo2 for example). --- daemon/virtualizer.c | 8 ++------ proxies/graph_proxy.c | 10 ++++++++-- proxies/graph_proxy.h | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/daemon/virtualizer.c b/daemon/virtualizer.c index 39c24571..b9b50c95 100644 --- a/daemon/virtualizer.c +++ b/daemon/virtualizer.c @@ -887,9 +887,7 @@ static bool ports_connect_request(void * context, ladish_graph_handle graph_hand port2_id = ladish_port_get_jack_id_room(port2); } - graph_proxy_connect_ports(virtualizer_ptr->jack_graph_proxy, port1_id, port2_id); - - return true; + return graph_proxy_connect_ports(virtualizer_ptr->jack_graph_proxy, port1_id, port2_id); } static bool ports_disconnect_request(void * context, ladish_graph_handle graph_handle, uint64_t connection_id) @@ -920,9 +918,7 @@ static bool ports_disconnect_request(void * context, ladish_graph_handle graph_h port2_id = ladish_port_get_jack_id_room(port2); } - graph_proxy_disconnect_ports(virtualizer_ptr->jack_graph_proxy, port1_id, port2_id); - - return true; + return graph_proxy_disconnect_ports(virtualizer_ptr->jack_graph_proxy, port1_id, port2_id); } static void ports_connected(void * context, uint64_t client1_id, uint64_t port1_id, uint64_t client2_id, uint64_t port2_id) diff --git a/proxies/graph_proxy.c b/proxies/graph_proxy.c index 6ff45097..75f17e7d 100644 --- a/proxies/graph_proxy.c +++ b/proxies/graph_proxy.c @@ -565,7 +565,7 @@ graph_proxy_detach( ASSERT(false); } -void +bool graph_proxy_connect_ports( graph_proxy_handle graph, uint64_t port1_id, @@ -574,10 +574,13 @@ graph_proxy_connect_ports( if (!dbus_call(graph_ptr->service, graph_ptr->object, JACKDBUS_IFACE_PATCHBAY, "ConnectPortsByID", "tt", &port1_id, &port2_id, "")) { log_error("ConnectPortsByID() failed."); + return false; } + + return true; } -void +bool graph_proxy_disconnect_ports( graph_proxy_handle graph, uint64_t port1_id, @@ -586,7 +589,10 @@ graph_proxy_disconnect_ports( if (!dbus_call(graph_ptr->service, graph_ptr->object, JACKDBUS_IFACE_PATCHBAY, "DisconnectPortsByID", "tt", &port1_id, &port2_id, "")) { log_error("DisconnectPortsByID() failed."); + return false; } + + return true; } static void on_client_appeared(void * graph, DBusMessage * message_ptr) diff --git a/proxies/graph_proxy.h b/proxies/graph_proxy.h index 45add1a9..d761f74b 100644 --- a/proxies/graph_proxy.h +++ b/proxies/graph_proxy.h @@ -75,13 +75,13 @@ graph_proxy_detach( graph_proxy_handle graph, void * context); -void +bool graph_proxy_connect_ports( graph_proxy_handle graph, uint64_t port1_id, uint64_t port2_id); -void +bool graph_proxy_disconnect_ports( graph_proxy_handle graph, uint64_t port1_id,