import spice-vdagent-0.21.0-4.el9
This commit is contained in:
parent
651642c07f
commit
0d6aa02d43
@ -0,0 +1,62 @@
|
||||
From 1aa2c06015e15f707ba9f874d5a5ea49fd450745 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Toso <victortoso@redhat.com>
|
||||
Date: Wed, 1 Dec 2021 20:07:22 +0100
|
||||
Subject: [PATCH 2/3] vdagent: udscs: limit retry to connect to vdagentd
|
||||
|
||||
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2005802
|
||||
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2028013
|
||||
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
||||
---
|
||||
src/vdagent/vdagent.c | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/src/vdagent/vdagent.c b/src/vdagent/vdagent.c
|
||||
index fd08522..0d3945e 100644
|
||||
--- a/src/vdagent/vdagent.c
|
||||
+++ b/src/vdagent/vdagent.c
|
||||
@@ -42,11 +42,14 @@
|
||||
#include "clipboard.h"
|
||||
#include "display.h"
|
||||
|
||||
+#define MAX_RETRY_CONNECT_SYSTEM_AGENT 60
|
||||
+
|
||||
typedef struct VDAgent {
|
||||
VDAgentClipboards *clipboards;
|
||||
VDAgentDisplay *display;
|
||||
struct vdagent_file_xfers *xfers;
|
||||
UdscsConnection *conn;
|
||||
+ gint udscs_num_retry;
|
||||
|
||||
GMainLoop *loop;
|
||||
} VDAgent;
|
||||
@@ -378,9 +381,27 @@ static gboolean vdagent_init_async_cb(gpointer user_data)
|
||||
daemon_read_complete, daemon_error_cb,
|
||||
debug);
|
||||
if (agent->conn == NULL) {
|
||||
+ if (agent->udscs_num_retry == MAX_RETRY_CONNECT_SYSTEM_AGENT) {
|
||||
+ syslog(LOG_WARNING,
|
||||
+ "Failed to connect to spice-vdagentd at %s (tried %d times)",
|
||||
+ vdagentd_socket, agent->udscs_num_retry);
|
||||
+ goto err_init;
|
||||
+ }
|
||||
+ if (agent->udscs_num_retry == 0) {
|
||||
+ /* Log only when it fails and at the end */
|
||||
+ syslog(LOG_DEBUG,
|
||||
+ "Failed to connect with spice-vdagentd. Trying again in 1s");
|
||||
+ }
|
||||
+ agent->udscs_num_retry++;
|
||||
g_timeout_add_seconds(1, vdagent_init_async_cb, agent);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
+ if (agent->udscs_num_retry != 0) {
|
||||
+ syslog(LOG_DEBUG,
|
||||
+ "Connected with spice-vdagentd after %d attempts",
|
||||
+ agent->udscs_num_retry);
|
||||
+ }
|
||||
+ agent->udscs_num_retry = 0;
|
||||
g_object_set_data(G_OBJECT(agent->conn), "agent", agent);
|
||||
|
||||
agent->display = vdagent_display_create(agent->conn, debug, x11_sync);
|
||||
--
|
||||
2.33.1
|
||||
|
@ -0,0 +1,98 @@
|
||||
From 09de02fd5cb12fcda3326e243981750c5358b7b6 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Toso <victortoso@redhat.com>
|
||||
Date: Mon, 20 Dec 2021 19:09:37 +0100
|
||||
Subject: [PATCH 3/3] udscs: udscs_connect: return error to caller
|
||||
|
||||
This way we can have the log in one place and avoid flooding the journal.
|
||||
|
||||
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
||||
---
|
||||
src/udscs.c | 10 ++++------
|
||||
src/udscs.h | 5 ++++-
|
||||
src/vdagent/vdagent.c | 12 +++++++++---
|
||||
3 files changed, 17 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/udscs.c b/src/udscs.c
|
||||
index 3df67b3..6c50f76 100644
|
||||
--- a/src/udscs.c
|
||||
+++ b/src/udscs.c
|
||||
@@ -107,16 +107,14 @@ static void udscs_connection_class_init(UdscsConnectionClass *klass)
|
||||
UdscsConnection *udscs_connect(const char *socketname,
|
||||
udscs_read_callback read_callback,
|
||||
VDAgentConnErrorCb error_cb,
|
||||
- int debug)
|
||||
+ int debug,
|
||||
+ GError **err)
|
||||
{
|
||||
GIOStream *io_stream;
|
||||
UdscsConnection *conn;
|
||||
- GError *err = NULL;
|
||||
|
||||
- io_stream = vdagent_socket_connect(socketname, &err);
|
||||
- if (err) {
|
||||
- syslog(LOG_ERR, "%s: %s", __func__, err->message);
|
||||
- g_error_free(err);
|
||||
+ io_stream = vdagent_socket_connect(socketname, err);
|
||||
+ if (*err) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
diff --git a/src/udscs.h b/src/udscs.h
|
||||
index 4f7ea36..0d4197b 100644
|
||||
--- a/src/udscs.h
|
||||
+++ b/src/udscs.h
|
||||
@@ -53,11 +53,14 @@ typedef void (*udscs_read_callback)(UdscsConnection *conn,
|
||||
*
|
||||
* If debug is true then the events on this connection will be traced.
|
||||
* This includes the incoming and outgoing message names.
|
||||
+ *
|
||||
+ * In case of failure, returns NULL and set @err with reason.
|
||||
*/
|
||||
UdscsConnection *udscs_connect(const char *socketname,
|
||||
udscs_read_callback read_callback,
|
||||
VDAgentConnErrorCb error_cb,
|
||||
- int debug);
|
||||
+ int debug,
|
||||
+ GError **err);
|
||||
|
||||
/* Queue a message for delivery to the client connected through conn.
|
||||
*/
|
||||
diff --git a/src/vdagent/vdagent.c b/src/vdagent/vdagent.c
|
||||
index 0d3945e..05d1a8f 100644
|
||||
--- a/src/vdagent/vdagent.c
|
||||
+++ b/src/vdagent/vdagent.c
|
||||
@@ -376,22 +376,28 @@ static void vdagent_destroy(VDAgent *agent)
|
||||
static gboolean vdagent_init_async_cb(gpointer user_data)
|
||||
{
|
||||
VDAgent *agent = user_data;
|
||||
+ GError *err = NULL;
|
||||
|
||||
agent->conn = udscs_connect(vdagentd_socket,
|
||||
- daemon_read_complete, daemon_error_cb,
|
||||
- debug);
|
||||
+ daemon_read_complete,
|
||||
+ daemon_error_cb,
|
||||
+ debug,
|
||||
+ &err);
|
||||
if (agent->conn == NULL) {
|
||||
if (agent->udscs_num_retry == MAX_RETRY_CONNECT_SYSTEM_AGENT) {
|
||||
syslog(LOG_WARNING,
|
||||
"Failed to connect to spice-vdagentd at %s (tried %d times)",
|
||||
vdagentd_socket, agent->udscs_num_retry);
|
||||
+ g_error_free(err);
|
||||
goto err_init;
|
||||
}
|
||||
if (agent->udscs_num_retry == 0) {
|
||||
/* Log only when it fails and at the end */
|
||||
syslog(LOG_DEBUG,
|
||||
- "Failed to connect with spice-vdagentd. Trying again in 1s");
|
||||
+ "Failed to connect with spice-vdagentd due '%s'. Trying again in 1s",
|
||||
+ err->message);
|
||||
}
|
||||
+ g_error_free(err);
|
||||
agent->udscs_num_retry++;
|
||||
g_timeout_add_seconds(1, vdagent_init_async_cb, agent);
|
||||
return G_SOURCE_REMOVE;
|
||||
--
|
||||
2.33.1
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: spice-vdagent
|
||||
Version: 0.21.0
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: Agent for Spice guests
|
||||
License: GPLv3+
|
||||
URL: https://spice-space.org/
|
||||
@ -9,6 +9,8 @@ Source1: https://spice-space.org/download/releases/%{name}-%{version}.tar
|
||||
Source2: jrope-7FDAB9AF.keyring
|
||||
|
||||
Patch0001: 0001-Fix-g_memdup-deprecation-warning-with-glib-2.68.patch
|
||||
Patch0002: 0002-vdagent-udscs-limit-retry-to-connect-to-vdagentd.patch
|
||||
Patch0003: 0003-udscs-udscs_connect-return-error-to-caller.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: systemd-devel
|
||||
@ -81,6 +83,10 @@ make install DESTDIR=$RPM_BUILD_ROOT V=2
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Dec 21 2021 Victor Toso <victortoso@redhat.com> 0.21.0-4
|
||||
- Limit session agent to (re)connect to system agent to a minute
|
||||
Related: rhbz#2028013
|
||||
|
||||
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.21.0-3
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
Loading…
Reference in New Issue
Block a user