summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2011-07-21 12:11:36 +0200
committerAlon Levy <alevy@redhat.com>2011-07-22 16:24:04 +0300
commitebe1cf76d4a86fea239b425caabe64aeaa2e13e2 (patch)
tree15ec6cd056306271ee6f26c741016cb4e8fa04b4
parent3f8d7e59dbd94b1837503f37b5065698df3ffbc7 (diff)
downloadspice-ebe1cf76d4a86fea239b425caabe64aeaa2e13e2.tar.gz
spice-ebe1cf76d4a86fea239b425caabe64aeaa2e13e2.tar.xz
spice-ebe1cf76d4a86fea239b425caabe64aeaa2e13e2.zip
client: don't die if initial agent timeout triggers
When the client connects to a spice VM, if an agent is detected, there will be a few messages exchanged to exchange capabilities, display resolutions, ... This exchange has a timeout in case something goes wrong. However, when it fires, the client dies. This commit changes this and lets the client connects to the guest when the timeout happens. rhbz #673973
-rw-r--r--client/red_client.cpp6
-rw-r--r--client/red_client.h6
2 files changed, 10 insertions, 2 deletions
diff --git a/client/red_client.cpp b/client/red_client.cpp
index 230e619e..6ba834ef 100644
--- a/client/red_client.cpp
+++ b/client/red_client.cpp
@@ -337,7 +337,9 @@ void AgentTimer::response(AbstractProcessLoop& events_loop)
{
Application* app = static_cast<Application*>(events_loop.get_owner());
app->deactivate_interval_timer(this);
- THROW_ERR(SPICEC_ERROR_CODE_AGENT_TIMEOUT, "vdagent timeout");
+
+ LOG_WARN("timeout while waiting for agent response");
+ _client->send_main_attach_channels();
}
class MainChannelLoop: public MessageHandlerImp<RedClient, SPICE_CHANNEL_MAIN> {
@@ -368,7 +370,7 @@ RedClient::RedClient(Application& application)
, _agent_out_msg_size (0)
, _agent_out_msg_pos (0)
, _agent_tokens (0)
- , _agent_timer (new AgentTimer())
+ , _agent_timer (new AgentTimer(this))
, _agent_caps_size(0)
, _agent_caps(NULL)
, _migrate (*this)
diff --git a/client/red_client.h b/client/red_client.h
index 4cb8e1a9..7fdba444 100644
--- a/client/red_client.h
+++ b/client/red_client.h
@@ -114,8 +114,14 @@ public:
}
};
+class RedClient;
+
class AgentTimer: public Timer {
+public:
virtual void response(AbstractProcessLoop& events_loop);
+ AgentTimer(RedClient *client) : _client(client) {};
+private:
+ RedClient *_client;
};
typedef std::map< int, RedPeer::ConnectionOptions::Type> PeerConnectionOptMap;