import spice-vdagent-0.20.0-4.el8

This commit is contained in:
CentOS Sources 2022-05-10 03:09:17 -04:00 committed by Stepan Oksanichenko
parent 60bdf9a070
commit 18d4405628
3 changed files with 167 additions and 1 deletions

View File

@ -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 20/21] 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

View File

@ -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 21/21] 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

View File

@ -1,6 +1,6 @@
Name: spice-vdagent
Version: 0.20.0
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Agent for Spice guests
Group: Applications/System
License: GPLv3+
@ -27,6 +27,8 @@ Patch0016: 0016-cleanup-active_xfers-when-the-client-disconnects.patch
Patch0017: 0017-vdagentd-do-not-allow-to-use-an-already-used-file-xf.patch
Patch0018: 0018-Add-a-test-for-session_info.patch
Patch0019: 0019-wayland-fix-monitor-mapping-issues.patch
Patch0020: 0020-vdagent-udscs-limit-retry-to-connect-to-vdagentd.patch
Patch0021: 0021-udscs-udscs_connect-return-error-to-caller.patch
BuildRequires: git-core gnupg2
BuildRequires: systemd-devel
@ -92,6 +94,10 @@ make install DESTDIR=$RPM_BUILD_ROOT V=2
%changelog
* Tue Dec 21 2021 Victor Toso <victortoso@redhat.com> 0.20.0-4
- Do not flood the journal with retry messages.
Resolves: rhbz#2005802
* Wed Jan 20 2021 Julien Ropé <jrope@redhat.com> - 0.20.0-3
- Fix mouse problems in multi-monitor environments under Wayland
Resolves: rhbz#1790904 rhbz#1824610