[spice-gtk v3 05/16] file-xfer: inform agent of errors only when task finished

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No need to inform of a problem under
spice_file_transfer_task_completed() as the task will be finalized and
we can send the error to the agent there.

This change is related to split SpiceFileTransferTask from
channel-main.

Acked-by: Pavel Grunt <pgrunt@xxxxxxxxxx>
---
 src/channel-main.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index 0ed322e..72dcf1f 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2968,16 +2968,6 @@ static void spice_file_transfer_task_completed(SpiceFileTransferTask *self,
         self->error = error;
     }
 
-    if (self->error) {
-        VDAgentFileXferStatusMessage msg = {
-            .id = self->id,
-            .result = self->error->code == G_IO_ERROR_CANCELLED ?
-                    VD_AGENT_FILE_XFER_STATUS_CANCELLED : VD_AGENT_FILE_XFER_STATUS_ERROR,
-        };
-        agent_msg_queue_many(self->channel, VD_AGENT_FILE_XFER_STATUS,
-                             &msg, sizeof(msg), NULL);
-    }
-
     if (self->pending)
         return;
 
@@ -3100,6 +3090,15 @@ static void task_finished(SpiceFileTransferTask *task,
     SpiceMainChannel *channel = SPICE_MAIN_CHANNEL(data);
     guint32 task_id = spice_file_transfer_task_get_id(task);
 
+    if (error) {
+        VDAgentFileXferStatusMessage msg;
+        msg.id = task_id;
+        msg.result = error->code == G_IO_ERROR_CANCELLED ?
+                VD_AGENT_FILE_XFER_STATUS_CANCELLED : VD_AGENT_FILE_XFER_STATUS_ERROR;
+        agent_msg_queue_many(channel, VD_AGENT_FILE_XFER_STATUS,
+                             &msg, sizeof(msg), NULL);
+    }
+
     g_hash_table_remove(channel->priv->file_xfer_tasks, GUINT_TO_POINTER(task_id));
 }
 
-- 
2.5.5

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]