|
|
07d9f9 |
From 8f74b35fa15fa08054e6f14612219f3818224f7b Mon Sep 17 00:00:00 2001
|
|
|
07d9f9 |
From: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
07d9f9 |
Date: Thu, 7 Apr 2016 15:42:14 -0500
|
|
|
07d9f9 |
Subject: [PATCH 4/5] Ensure that file transfers get cancelled
|
|
|
07d9f9 |
|
|
|
07d9f9 |
When canceling a file transfer task in spicy, the client would often
|
|
|
07d9f9 |
stop sending additional data, but it would not send a "CANCELLED"
|
|
|
07d9f9 |
message to the guest. Because of this, the partial file would remain in
|
|
|
07d9f9 |
the guest's downloads folder until the spice client disconnected, at
|
|
|
07d9f9 |
which point the vdagent would remove the unfinshed file.
|
|
|
07d9f9 |
|
|
|
07d9f9 |
This CANCELLED status message was only being sent if the task was
|
|
|
07d9f9 |
canceled during the async file read operation. If you cancel a task,
|
|
|
07d9f9 |
it's quite likely that it will happen during other operations
|
|
|
07d9f9 |
(e.g. file_xfer_flush_async(), etc). In order to handle these scenarios
|
|
|
07d9f9 |
(and make sure that the file gets canceled properly), send the
|
|
|
07d9f9 |
FILE_XFER_STATUS message in spice_file_transfer_task_completed().
|
|
|
07d9f9 |
|
|
|
07d9f9 |
(cherry picked from commit 4da4d9201cc3f86e38f00388cdd6157fe70e3328)
|
|
|
07d9f9 |
---
|
|
|
07d9f9 |
src/channel-main.c | 17 ++++++++++-------
|
|
|
07d9f9 |
1 file changed, 10 insertions(+), 7 deletions(-)
|
|
|
07d9f9 |
|
|
|
07d9f9 |
diff --git a/src/channel-main.c b/src/channel-main.c
|
|
|
07d9f9 |
index e5a70af..67fce5b 100644
|
|
|
07d9f9 |
--- a/src/channel-main.c
|
|
|
07d9f9 |
+++ b/src/channel-main.c
|
|
|
07d9f9 |
@@ -1919,13 +1919,6 @@ static void file_xfer_read_cb(GObject *source_object,
|
|
|
07d9f9 |
file_xfer_data_flushed_cb, self);
|
|
|
07d9f9 |
self->priv->pending = TRUE;
|
|
|
07d9f9 |
} else if (error) {
|
|
|
07d9f9 |
- VDAgentFileXferStatusMessage msg = {
|
|
|
07d9f9 |
- .id = self->priv->id,
|
|
|
07d9f9 |
- .result = error->code == G_IO_ERROR_CANCELLED ?
|
|
|
07d9f9 |
- VD_AGENT_FILE_XFER_STATUS_CANCELLED : VD_AGENT_FILE_XFER_STATUS_ERROR,
|
|
|
07d9f9 |
- };
|
|
|
07d9f9 |
- agent_msg_queue_many(self->priv->channel, VD_AGENT_FILE_XFER_STATUS,
|
|
|
07d9f9 |
- &msg, sizeof(msg), NULL);
|
|
|
07d9f9 |
spice_channel_wakeup(SPICE_CHANNEL(self->priv->channel), FALSE);
|
|
|
07d9f9 |
spice_file_transfer_task_completed(self, error);
|
|
|
07d9f9 |
}
|
|
|
07d9f9 |
@@ -2946,6 +2939,16 @@ static void spice_file_transfer_task_completed(SpiceFileTransferTask *self,
|
|
|
07d9f9 |
self->priv->error = error;
|
|
|
07d9f9 |
}
|
|
|
07d9f9 |
|
|
|
07d9f9 |
+ if (self->priv->error) {
|
|
|
07d9f9 |
+ VDAgentFileXferStatusMessage msg = {
|
|
|
07d9f9 |
+ .id = self->priv->id,
|
|
|
07d9f9 |
+ .result = error->code == G_IO_ERROR_CANCELLED ?
|
|
|
07d9f9 |
+ VD_AGENT_FILE_XFER_STATUS_CANCELLED : VD_AGENT_FILE_XFER_STATUS_ERROR,
|
|
|
07d9f9 |
+ };
|
|
|
07d9f9 |
+ agent_msg_queue_many(self->priv->channel, VD_AGENT_FILE_XFER_STATUS,
|
|
|
07d9f9 |
+ &msg, sizeof(msg), NULL);
|
|
|
07d9f9 |
+ }
|
|
|
07d9f9 |
+
|
|
|
07d9f9 |
if (self->priv->pending)
|
|
|
07d9f9 |
return;
|
|
|
07d9f9 |
|
|
|
07d9f9 |
--
|
|
|
07d9f9 |
2.8.1
|
|
|
07d9f9 |
|