diff options
author | Victor Toso <victortoso@redhat.com> | 2016-06-15 16:07:48 +0200 |
---|---|---|
committer | Victor Toso <victortoso@redhat.com> | 2016-07-07 16:19:23 +0200 |
commit | da47c8ad3613f64e1b26472883cc5e317b87d851 (patch) | |
tree | e6929113b687109b3843fd5bd4df7aafb0a09b5a | |
parent | 7865b0d7fbb1745bda11e99e4774debc6951ceb1 (diff) |
file-xfer: improve helper function to queue agent message
This patch changes:
* rename function: file_xfer_queue -> file_xfer_queue_msg_to_agent
As it makes more clear what this helper function does;
* 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.
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
-rw-r--r-- | src/channel-main.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/channel-main.c b/src/channel-main.c index 00da57c..7199152 100644 --- a/src/channel-main.c +++ b/src/channel-main.c @@ -1934,19 +1934,20 @@ 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(SpiceMainChannel *channel, + guint32 task_id, + gchar *buffer, + gint data_size) { VDAgentFileXferDataMessage msg; - SpiceMainChannel *channel; - channel = spice_file_transfer_task_get_channel(self); g_return_if_fail(channel != NULL); - msg.id = spice_file_transfer_task_get_id(self); + msg.id = task_id; 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); } @@ -1972,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(channel, spice_file_transfer_task_get_id(xfer_task), buffer, count); if (count == 0) { /* on EOF just wait for VD_AGENT_FILE_XFER_STATUS from agent */ return; |