Blame SOURCES/0024-vdagentd-send-file-xfer-status-generic-version.patch

a547b4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a547b4
From: Victor Toso <victortoso@redhat.com>
a547b4
Date: Tue, 3 May 2016 10:25:52 +0200
a547b4
Subject: [PATCH] vdagentd: send file-xfer status, generic version
a547b4
a547b4
Change cancel_file_xfer() helper function to file_xfer_status() so we
a547b4
can send other status to the client.
a547b4
a547b4
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
a547b4
(cherry picked from commit b5f0352e9e5ea91eff0880674cbc5080e78c9e5b)
a547b4
---
a547b4
 src/vdagentd.c | 18 +++++++++++-------
a547b4
 1 file changed, 11 insertions(+), 7 deletions(-)
a547b4
a547b4
diff --git a/src/vdagentd.c b/src/vdagentd.c
a547b4
index 594f36b..2c8e973 100644
a547b4
--- a/src/vdagentd.c
a547b4
+++ b/src/vdagentd.c
a547b4
@@ -244,12 +244,14 @@ static void do_client_clipboard(struct vdagent_virtio_port *vport,
a547b4
                 data, size);
a547b4
 }
a547b4
 
a547b4
-static void cancel_file_xfer(struct vdagent_virtio_port *vport,
a547b4
-                             const char *msg, uint32_t id)
a547b4
+/* To be used by vdagentd for failures in file-xfer such as when file-xfer was
a547b4
+ * cancelled or an error happened */
a547b4
+static void send_file_xfer_status(struct vdagent_virtio_port *vport,
a547b4
+                                  const char *msg, uint32_t id, uint32_t xfer_status)
a547b4
 {
a547b4
     VDAgentFileXferStatusMessage status = {
a547b4
         .id = id,
a547b4
-        .result = VD_AGENT_FILE_XFER_STATUS_CANCELLED,
a547b4
+        .result = xfer_status,
a547b4
     };
a547b4
     syslog(LOG_WARNING, msg, id);
a547b4
     if (vport)
a547b4
@@ -269,10 +271,10 @@ static void do_client_file_xfer(struct vdagent_virtio_port *vport,
a547b4
     case VD_AGENT_FILE_XFER_START: {
a547b4
         VDAgentFileXferStartMessage *s = (VDAgentFileXferStartMessage *)data;
a547b4
         if (!active_session_conn) {
a547b4
-            cancel_file_xfer(vport,
a547b4
+            send_file_xfer_status(vport,
a547b4
                "Could not find an agent connnection belonging to the "
a547b4
                "active session, cancelling client file-xfer request %u",
a547b4
-               s->id);
a547b4
+               s->id, VD_AGENT_FILE_XFER_STATUS_CANCELLED);
a547b4
             return;
a547b4
         }
a547b4
         udscs_write(active_session_conn, VDAGENTD_FILE_XFER_START, 0, 0,
a547b4
@@ -617,8 +619,10 @@ void update_active_session_connection(struct udscs_connection *new_conn)
a547b4
 gboolean remove_active_xfers(gpointer key, gpointer value, gpointer conn)
a547b4
 {
a547b4
     if (value == conn) {
a547b4
-        cancel_file_xfer(virtio_port, "Agent disc; cancelling file-xfer %u",
a547b4
-                         GPOINTER_TO_UINT(key));
a547b4
+        send_file_xfer_status(virtio_port,
a547b4
+                              "Agent disc; cancelling file-xfer %u",
a547b4
+                              GPOINTER_TO_UINT(key),
a547b4
+                              VD_AGENT_FILE_XFER_STATUS_CANCELLED);
a547b4
         return 1;
a547b4
     } else
a547b4
         return 0;