[Spice-devel] [PATCH vd_agent_linux] vdagent: Stop trying to connect to the daemon after a while
Frediano Ziglio
fziglio at redhat.com
Fri Nov 16 16:21:15 UTC 2018
Do not try indefinitely to connect to the daemon, should not
take long to activate.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
src/vdagent/vdagent.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/vdagent/vdagent.c b/src/vdagent/vdagent.c
index f7c8b72..e0228d7 100644
--- a/src/vdagent/vdagent.c
+++ b/src/vdagent/vdagent.c
@@ -53,6 +53,7 @@ typedef struct VDAgent {
struct vdagent_file_xfers *xfers;
struct udscs_connection *conn;
GIOChannel *x11_channel;
+ guint connection_attempts;
GMainLoop *loop;
} VDAgent;
@@ -370,6 +371,10 @@ static gboolean vdagent_init_async_cb(gpointer user_data)
daemon_read_complete, daemon_disconnect_cb,
debug);
if (agent->conn == NULL) {
+ // limit connection attempts, this will try for 5 minutes
+ if (++agent->connection_attempts > 5 * 60) {
+ goto err_init;
+ }
g_timeout_add_seconds(1, vdagent_init_async_cb, agent);
return G_SOURCE_REMOVE;
}
--
2.17.2
More information about the Spice-devel
mailing list