[Spice-commits] src/channel-main.c

Victor Toso de Carvalho victortoso at kemper.freedesktop.org
Fri May 27 07:12:38 UTC 2016


 src/channel-main.c |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 349a52ca2d6af4b31a4f51c38a3292c04460953c
Author: Victor Toso <victortoso at redhat.com>
Date:   Mon May 16 15:09:31 2016 +0200

    file-xfer: make handle_status agnostic of channel-main
    
    This make possible to rename the function to
    spice_file_transfer_task_handle_status as a handler for
    VDAgentFileXferStatusMessage for a specific task.
    
    This change is related to split SpiceFileTransferTask from
    channel-main.
    
    Acked-by: Pavel Grunt <pgrunt at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/src/channel-main.c b/src/channel-main.c
index b91daa5..dc93168 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1981,18 +1981,11 @@ static void file_xfer_continue_read(SpiceFileTransferTask *self)
 }
 
 /* coroutine context */
-static void file_xfer_handle_status(SpiceMainChannel *channel,
-                                    VDAgentFileXferStatusMessage *msg)
+static void spice_file_transfer_task_handle_status(SpiceFileTransferTask *task,
+                                                   VDAgentFileXferStatusMessage *msg)
 {
-    SpiceMainChannelPrivate *c = channel->priv;
-    SpiceFileTransferTask *task;
     GError *error = NULL;
-
-    task = g_hash_table_lookup(c->file_xfer_tasks, GUINT_TO_POINTER(msg->id));
-    if (task == NULL) {
-        SPICE_DEBUG("cannot find task %d", msg->id);
-        return;
-    }
+    g_return_if_fail(task != NULL);
 
     SPICE_DEBUG("task %d received response %d", msg->id, msg->result);
 
@@ -2169,8 +2162,18 @@ static void main_agent_handle_msg(SpiceChannel *channel,
         break;
     }
     case VD_AGENT_FILE_XFER_STATUS:
-        file_xfer_handle_status(self, payload);
+    {
+        SpiceFileTransferTask *task;
+        VDAgentFileXferStatusMessage *msg = payload;
+
+        task = g_hash_table_lookup(c->file_xfer_tasks, GUINT_TO_POINTER(msg->id));
+        if (task != NULL) {
+            spice_file_transfer_task_handle_status(task, msg);
+        } else {
+            SPICE_DEBUG("cannot find task %d", msg->id);
+        }
         break;
+    }
     default:
         g_warning("unhandled agent message type: %u (%s), size %u",
                   msg->type, NAME(agent_msg_types, msg->type), msg->size);


More information about the Spice-commits mailing list