[Spice-devel] [linux-vdagent PATCH 06/10] file-xfers: Report status to sender (the client) on xfer completion

Hans de Goede hdegoede at redhat.com
Wed Mar 6 07:22:42 PST 2013


Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/vdagent-file-xfers.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/vdagent-file-xfers.c b/src/vdagent-file-xfers.c
index 898b77f..faff743 100644
--- a/src/vdagent-file-xfers.c
+++ b/src/vdagent-file-xfers.c
@@ -255,7 +255,7 @@ void vdagent_file_xfers_data(struct vdagent_file_xfers *xfers,
     VDAgentFileXferDataMessage *msg)
 {
     AgentFileXferTask *task;
-    int len;
+    int len, status = -1;
 
     task = vdagent_file_xfers_get_task(xfers, msg->id);
     if (!task)
@@ -277,8 +277,13 @@ void vdagent_file_xfers_data(struct vdagent_file_xfers *xfers,
                        task->id, task->file_name);
             close(task->file_fd);
             task->file_fd = -1;
-        } else
+            status = VD_AGENT_FILE_XFER_STATUS_SUCCESS;
+        } else {
             syslog(LOG_ERR, "file-xfer: error received too much data");
+            status = VD_AGENT_FILE_XFER_STATUS_ERROR;
+        }
+        udscs_write(xfers->vdagentd, VDAGENTD_FILE_XFER_STATUS,
+                    msg->id, status, NULL, 0);
         g_hash_table_remove(xfers->xfers, GUINT_TO_POINTER(msg->id));
     }
 }
-- 
1.8.1.4



More information about the Spice-devel mailing list