[Spice-devel] [spice-gtk v2 05/16] file-xfer: inform agent of errors only when task finished
Pavel Grunt
pgrunt at redhat.com
Fri May 27 09:19:16 UTC 2016
On Mon, 2016-05-23 at 13:50 +0200, Victor Toso wrote:
> No need to inform of a problem under
> spice_file_transfer_task_completed() as the task will be finalized and
> we can send the error to the agent there.
>
It sounds good
> This change is related to split SpiceFileTransferTask from
> channel-main.
Acked-by: Pavel Grunt <pgrunt at redhat.com>
> ---
> src/channel-main.c | 19 +++++++++----------
> 1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/src/channel-main.c b/src/channel-main.c
> index 6aaf96e..de5330f 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -2963,16 +2963,6 @@ static void
> spice_file_transfer_task_completed(SpiceFileTransferTask *self,
> self->priv->error = error;
> }
>
> - if (self->priv->error) {
> - VDAgentFileXferStatusMessage msg = {
> - .id = self->priv->id,
> - .result = self->priv->error->code == G_IO_ERROR_CANCELLED ?
> - VD_AGENT_FILE_XFER_STATUS_CANCELLED :
> VD_AGENT_FILE_XFER_STATUS_ERROR,
> - };
> - agent_msg_queue_many(self->priv->channel, VD_AGENT_FILE_XFER_STATUS,
> - &msg, sizeof(msg), NULL);
> - }
> -
> if (self->priv->pending)
> return;
>
> @@ -3095,6 +3085,15 @@ static void task_finished(SpiceFileTransferTask *task,
> SpiceMainChannel *channel = SPICE_MAIN_CHANNEL(data);
> guint32 task_id;
>
> + if (error) {
> + VDAgentFileXferStatusMessage msg;
> + g_object_get(task, "id", &msg.id, NULL);
> + msg.result = error->code == G_IO_ERROR_CANCELLED ?
> + VD_AGENT_FILE_XFER_STATUS_CANCELLED :
> VD_AGENT_FILE_XFER_STATUS_ERROR;
> + agent_msg_queue_many(channel, VD_AGENT_FILE_XFER_STATUS,
> + &msg, sizeof(msg), NULL);
> + }
> +
> g_object_get(task, "id", &task_id, NULL);
> g_hash_table_remove(channel->priv->file_xfer_tasks,
> GUINT_TO_POINTER(task_id));
> }
More information about the Spice-devel
mailing list