[Spice-devel] [PATCH spice-gtk 14/16] channel-main: Check no callbacks are pending on xfer start and end

Hans de Goede hdegoede at redhat.com
Fri Mar 29 04:40:26 PDT 2013


We should never have pending callbacks when we receive a file-xfer start or
end (success) message from the agent.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/channel-main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 5a05651..7513ead 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1700,6 +1700,11 @@ static void file_xfer_handle_status(SpiceMainChannel *channel,
 
     switch (msg->result) {
     case VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA:
+        if (task->pending) {
+            error = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
+                           "transfer received CAN_SEND_DATA in pending state");
+            break;
+        }
         file_xfer_continue_read(task);
         return;
     case VD_AGENT_FILE_XFER_STATUS_CANCELLED:
@@ -1711,6 +1716,9 @@ static void file_xfer_handle_status(SpiceMainChannel *channel,
                             "some errors occurred in the spice agent");
         break;
     case VD_AGENT_FILE_XFER_STATUS_SUCCESS:
+        if (task->pending)
+            error = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
+                                "transfer received success in pending state");
         break;
     default:
         g_warn_if_reached();
-- 
1.8.1.4



More information about the Spice-devel mailing list