[spice-gtk v2 01/16] file-xfer: make handle_status agnostic of channel-main

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/channel-main.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index dec5d73..4fb514e 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1957,18 +1957,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);
 
@@ -2145,8 +2138,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);
-- 
2.5.5

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]