summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2014-08-28 10:35:41 -0500
committerJonathon Jongsma <jjongsma@redhat.com>2014-08-28 16:02:31 -0500
commitbefd4f142a00fbef555560e542e9ed210c2960b7 (patch)
tree31133cd7a4546edba590bbdd702938db0f2ccc17
parent0019878f48897e6af7bc07bf7f866091383f4a66 (diff)
Wait to send monitor config until agent caps are received
When the first display is disabled and the vdagent is restarted in the guest, it sometimes becomes enabled. This appears to be caused by a race condition when an agent becomes connected. When the agent becomes connected, virt-viewer triggers a display update (spice_main_send_monitor_config()). This display update happens in a timeout handler, but the timeout interval is set to 0 (so it behaves basically like an idle handler). The race happens because spice_main_send_monitor_config() behaves slightly differently depending on the agent's capabilities. And sometimes the idle handler runs before the client and server have negotiated capabilities. In this case, we have to assume that the server does not support sparse monitor configurations. So instead of sending down an update where display #0 is off and display #1 is WxH, we send down an update that only a single display: display #0 is WxH. This results in the first display becoming enabled. To solve the issue, we wait until the agent negotiates capabilities before sending the display configuration message. Resolves: rhbz#1043782, rhbz#1032923
-rw-r--r--gtk/channel-main.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index f33b0fd..6c1b3be 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1508,7 +1508,6 @@ static void main_handle_mouse_mode(SpiceChannel *channel, SpiceMsgIn *in)
static void main_handle_agent_connected(SpiceChannel *channel, SpiceMsgIn *in)
{
agent_start(SPICE_MAIN_CHANNEL(channel));
- update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
}
/* coroutine context */
@@ -1519,7 +1518,6 @@ static void main_handle_agent_connected_tokens(SpiceChannel *channel, SpiceMsgIn
c->agent_tokens = msg->num_tokens;
agent_start(SPICE_MAIN_CHANNEL(channel));
- update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
}
/* coroutine context */
@@ -1790,6 +1788,7 @@ static void main_agent_handle_msg(SpiceChannel *channel,
}
c->agent_caps_received = true;
g_coroutine_signal_emit(self, signals[SPICE_MAIN_AGENT_UPDATE], 0);
+ update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
if (caps->request)
agent_announce_caps(self);