Hi, On 11/22/2012 05:07 PM, Marc-André Lureau wrote:
Note with this patch, the previous patch is unnecessary: the configuration can be sent to all agents (gdm & user) the creation/deletion races will be ignored.
Cool, good way to test the race robustness of the code. Still I think it would be better to just not race at all, I know that cannot be completely avoided. But lets at least fix the agents racing amongst themselves. The attached patch (untested) Regards, Hans
>From a5352d7afeda615f370cebcbd68bded6840e6753 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@xxxxxxxxxx> Date: Thu, 22 Nov 2012 17:25:38 +0100 Subject: [linux-vdagent PATCH] vdagentd: send monitors config to currently active agent only --- src/vdagentd.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/vdagentd.c b/src/vdagentd.c index a4db935..bd5e0d4 100644 --- a/src/vdagentd.c +++ b/src/vdagentd.c @@ -130,9 +130,10 @@ static void do_client_monitors(struct vdagent_virtio_port *vport, int port_nr, } memcpy(mon_config, new_monitors, size); - /* Send monitor config to currently connected agents */ - udscs_server_write_all(server, VDAGENTD_MONITORS_CONFIG, 0, 0, - (uint8_t *)mon_config, size); + /* Send monitor config to currently active agent */ + if (active_session_conn) + udscs_write(active_session_conn, VDAGENTD_MONITORS_CONFIG, 0, 0, + (uint8_t *)mon_config, size); /* Acknowledge reception of monitors config to spice server / client */ reply.type = VD_AGENT_MONITORS_CONFIG; @@ -494,6 +495,10 @@ void update_active_session_connection(void) active_session_conn = new_conn; if (debug) syslog(LOG_DEBUG, "%p is now the active session", new_conn); + if (active_session_conn && mon_config) + udscs_write(active_session_conn, VDAGENTD_MONITORS_CONFIG, 0, 0, + (uint8_t *)mon_config, sizeof(VDAgentMonitorsConfig) + + mon_config->num_of_monitors * sizeof(VDAgentMonConfig)); #endif release_clipboards(); @@ -531,15 +536,9 @@ void agent_connect(struct udscs_connection *conn) #endif udscs_set_user_data(conn, (void *)agent_data); - update_active_session_connection(); - udscs_write(conn, VDAGENTD_VERSION, 0, 0, (uint8_t *)VERSION, strlen(VERSION) + 1); - - if (mon_config) - udscs_write(conn, VDAGENTD_MONITORS_CONFIG, 0, 0, - (uint8_t *)mon_config, sizeof(VDAgentMonitorsConfig) + - mon_config->num_of_monitors * sizeof(VDAgentMonConfig)); + update_active_session_connection(); } void agent_disconnect(struct udscs_connection *conn) -- 1.8.0
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel