[Spice-devel] [vdagent-win v1] file-transfer: empty data message can be ignored

Victor Toso victortoso at redhat.com
Wed Aug 10 14:22:34 UTC 2016


Based on bug solved for linux guest [0], client might send message
with 0 bytes. This situation might trigger a warning in the VDAgent as
it does not expect it; VDAgent will send
VD_AGENT_FILE_XFER_STATUS_ERROR which triggers an error in the client
too as it already sent all the data.

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1135099

Simple fix is to ignore zero sized messages when we don't find the
xfer-task.

Resolves: https://bugs.freedesktop.org/show_bug.cgi?id=97227
---
 vdagent/file_xfer.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index 58d3a31..e64fe89 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -119,7 +119,12 @@ bool FileXfer::handle_data(VDAgentFileXferDataMessage* data,
     status->result = VD_AGENT_FILE_XFER_STATUS_ERROR;
     iter = _tasks.find(data->id);
     if (iter == _tasks.end()) {
-        vd_printf("file id %u not found", data->id);
+        if (data->size == 0) {
+            vd_printf("file id %u does not exist anymore. "
+                      "Ignoring empty data message", data->id);
+            return false;
+        }
+        vd_printf("file id %u not found (size is %llu)", data->id, data->size);
         goto fin;
     }
     task = iter->second;
-- 
2.7.4



More information about the Spice-devel mailing list