summaryrefslogtreecommitdiffstats
path: root/client/red_client.cpp
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2011-07-06 16:26:01 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2011-07-18 18:15:40 +0200
commit492f7a9b84c60e3638c182cb7d0c5b62effbe1bd (patch)
treedca1cbcb0152f26be271324bfe7101c0c7a5d701 /client/red_client.cpp
parent44073d1b38e29beb6076c7c1340625ecfb78ff2d (diff)
downloadspice-492f7a9b84c60e3638c182cb7d0c5b62effbe1bd.tar.gz
spice-492f7a9b84c60e3638c182cb7d0c5b62effbe1bd.tar.xz
spice-492f7a9b84c60e3638c182cb7d0c5b62effbe1bd.zip
client: don't crash when agent is missing WAN support
If you try to connect to a linux guest with WAN options, SPICE window opens up and is blank - it then fails with vdagent timeout message. It should give a warning that this is only applicable for windows guest and still connect to guest. It all starts in RedClient::handle_init This function checks whether we have an agent or not, because if we have an agent, there will be some kind of handshake to check both sides capabilities before all the spice channels are created. When there is no agent running, the startup process goes on with SPICE_MSGC_MAIN_ATTACH_CHANNELS When there is a windows agent running, VD_AGENT_ANNOUNCE_CAPABILITIES and VD_AGENT_DISPLAY_CONFIG messages are sent to the agent, and when processing the agent answer to the VD_AGENT_DISPLAY_CONFIG message, SPICE_MSGC_MAIN_ATTACH_CHANNELS will be sent and the startup process will go on. However, when there is no agent running but --color-depth was used, handle_init won't send the SPICE_MSGC_MAIN_ATTACH_CHANNELS message but will wait for the agent handshake to proceed to its end, which won't happen, so it will timeout waiting for agent answers. Similarly, the linux agent handles VD_AGENT_ANNOUNCE_CAPABILITIES messages, but it doesn't handle VD_AGENT_DISPLAY_CONFIG messages, so we'll never reach the point where a SPICE_MSGC_MAIN_ATTACH_CHANNELS will be sent. This commit fixes this in 2 places: - unconditionnally send SPICE_MSGC_ATTACH_CHANNELS when no agent is running in handle_init - send SPICE_MSGC_MAIN_ATTACH_CHANNELS in RedClient::on_agent_announce_capabilities if the agent doesn't have the VD_AGENT_CAP_DISPLAY_CONFIG capability This fixes RH bug #712938
Diffstat (limited to 'client/red_client.cpp')
-rw-r--r--client/red_client.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/client/red_client.cpp b/client/red_client.cpp
index 8918e4fc..67690e90 100644
--- a/client/red_client.cpp
+++ b/client/red_client.cpp
@@ -966,19 +966,20 @@ void RedClient::handle_init(RedPeer::InMessage* message)
agent_start.num_tokens = ~0;
_marshallers->msgc_main_agent_start(msg->marshaller(), &agent_start);
post_message(msg);
- }
-
- if (_agent_connected) {
send_agent_announce_capabilities(true);
if (_auto_display_res) {
send_agent_monitors_config();
}
- }
-
- if (!_auto_display_res && _display_setting.is_empty()) {
- post_message(new Message(SPICE_MSGC_MAIN_ATTACH_CHANNELS));
+ if (_auto_display_res || !_display_setting.is_empty()) {
+ _application.activate_interval_timer(*_agent_timer, AGENT_TIMEOUT);
+ } else {
+ post_message(new Message(SPICE_MSGC_MAIN_ATTACH_CHANNELS));
+ }
} else {
- _application.activate_interval_timer(*_agent_timer, AGENT_TIMEOUT);
+ if (_auto_display_res || !_display_setting.is_empty()) {
+ LOG_WARN("no agent running, display options have been ignored");
+ }
+ post_message(new Message(SPICE_MSGC_MAIN_ATTACH_CHANNELS));
}
}
@@ -1046,6 +1047,17 @@ void RedClient::on_agent_announce_capabilities(
// not sending the color depth through send_agent_monitors_config, since
// it applies only for attached screens.
send_agent_display_config();
+ } else if (!_auto_display_res) {
+ /* some agents don't support monitors/displays agent messages, so
+ * we'll never reach on_agent_reply which sends this
+ * ATTACH_CHANNELS message which is needed for client startup to go
+ * on.
+ */
+ if (!_display_setting.is_empty()) {
+ LOG_WARN("display options have been requested, but the agent doesn't support these options");
+ }
+ post_message(new Message(SPICE_MSGC_MAIN_ATTACH_CHANNELS));
+ _application.deactivate_interval_timer(*_agent_timer);
}
}