[Spice-devel] [spice-gtk v2 01/16] file-xfer: make handle_status agnostic of channel-main
Victor Toso
victortoso at redhat.com
Mon May 23 11:50:38 UTC 2016
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>
---
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
More information about the Spice-devel
mailing list