summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Toso <me@victortoso.com>2016-11-11 14:19:53 +0100
committerVictor Toso <me@victortoso.com>2016-11-14 22:07:28 +0100
commit885229393e3198bd4b386cf71a51832439dfb31b (patch)
tree15f89237e2e5e0f6e5bb33d32e60b01718654cad
parente0a6ca62acb2d2e46304a9ce6b1dcb41e0534587 (diff)
file-xfer: do not send unnecessary 0 bytes messages
This fixes the situation when VDAgent receives 0 byte message regarding a file-transfer operation that was terminated in the previous message. This makes the VDAgent to send a STATUS_ERROR after STATUS_SUCCESS to client. Resolves: https://bugs.freedesktop.org/show_bug.cgi?id=97227 Signed-off-by: Victor Toso <victortoso@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
-rw-r--r--src/channel-main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/channel-main.c b/src/channel-main.c
index 990a06a..72ca712 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1822,6 +1822,14 @@ static void file_xfer_read_async_cb(GObject *source_object,
return;
}
+ if (count == 0 && spice_file_transfer_task_get_total_bytes(xfer_task) > 0) {
+ /* If we have sent all payload to the agent, we should not send 0 bytes
+ * as it will cause https://bugs.freedesktop.org/show_bug.cgi?id=97227.
+ * Only when file has 0 bytes of size is when we should send 0 bytes to
+ * agent, see: https://bugzilla.redhat.com/show_bug.cgi?id=1135099 */
+ return;
+ }
+
file_xfer_queue_msg_to_agent(channel, spice_file_transfer_task_get_id(xfer_task), buffer, count);
if (count == 0 || spice_file_transfer_task_is_completed(xfer_task)) {
/* on EOF just wait for VD_AGENT_FILE_XFER_STATUS from agent