[Spice-devel] [spice-gtk v4 10/24] file-xfer: improve helper function to queue agent message
Victor Toso
victortoso at redhat.com
Thu Jun 23 17:37:42 UTC 2016
file_xfer_queue() function belongs to channel-main so it should not
access SpiceFileTransferTask private struct (self->buffer).
This patch changes:
* rename function: file_xfer_queue -> file_xfer_queue_msg_to_agent
As it makes more clear what this helper function does;
* rename variabale: self -> xfer_task
As this is not a SpiceFileTransferTask' function.
* Use buffer provided by spice_file_transfer_task_read_finish()
instead of accessing SpiceFileTransferTask's private structure
This change is related to split SpiceFileTransferTask from
channel-main.
---
src/channel-main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/channel-main.c b/src/channel-main.c
index fef72cd..e57ee73 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1935,19 +1935,19 @@ static void file_xfer_data_flushed_cb(GObject *source_object,
spice_file_transfer_task_read_async(self, file_xfer_read_async_cb, NULL);
}
-static void file_xfer_queue(SpiceFileTransferTask *self, int data_size)
+static void file_xfer_queue_msg_to_agent(SpiceFileTransferTask *xfer_task, gchar *buffer, int data_size)
{
VDAgentFileXferDataMessage msg;
SpiceMainChannel *channel;
- channel = spice_file_transfer_task_get_channel(self);
+ channel = spice_file_transfer_task_get_channel(xfer_task);
g_return_if_fail(channel != NULL);
- msg.id = spice_file_transfer_task_get_id(self);
+ msg.id = spice_file_transfer_task_get_id(xfer_task);
msg.size = data_size;
agent_msg_queue_many(channel, VD_AGENT_FILE_XFER_DATA,
&msg, sizeof(msg),
- self->buffer, data_size, NULL);
+ buffer, data_size, NULL);
spice_channel_wakeup(SPICE_CHANNEL(channel), FALSE);
}
@@ -1973,7 +1973,7 @@ static void file_xfer_read_async_cb(GObject *source_object,
return;
}
- file_xfer_queue(xfer_task, count);
+ file_xfer_queue_msg_to_agent(xfer_task, buffer, count);
if (count == 0)
/* on EOF just wait for VD_AGENT_FILE_XFER_STATUS from agent */
return;
--
2.7.4
More information about the Spice-devel
mailing list