Re: [PATCH spice-gtk] main: Handle lack of free space for file transfer

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

 



Hi Jakub,

On Wed, 2017-05-03 at 16:29 +0200, Jakub Janků wrote:
> Agent can send FileXferStatusMessage with result
> VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE together with info about
> amount of available free space when the file to transfer is too
> large
> and the client announces support of this result by sending
> VD_AGENT_CAP_FILE_XFER_FREE_SPACE
> ---
>  src/channel-main.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/channel-main.c b/src/channel-main.c
> index bbc5905..16e1651 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -1321,6 +1321,7 @@ static void
> agent_announce_caps(SpiceMainChannel *channel)
>      VD_AGENT_SET_CAPABILITY(caps->caps,
> VD_AGENT_CAP_CLIPBOARD_BY_DEMAND);
>      VD_AGENT_SET_CAPABILITY(caps->caps,
> VD_AGENT_CAP_CLIPBOARD_SELECTION);
>      VD_AGENT_SET_CAPABILITY(caps->caps,
> VD_AGENT_CAP_MONITORS_CONFIG_POSITION);
> +    VD_AGENT_SET_CAPABILITY(caps->caps,
> VD_AGENT_CAP_FILE_XFER_FREE_SPACE);
>  
>      agent_msg_queue(channel, VD_AGENT_ANNOUNCE_CAPABILITIES, size,
> caps);
>      g_free(caps);
> @@ -1870,6 +1871,13 @@ static void
> main_agent_handle_xfer_status(SpiceMainChannel *channel,
>          error = g_error_new_literal(SPICE_CLIENT_ERROR,
> SPICE_CLIENT_ERROR_FAILED,
>                                      _("The spice agent reported an
> error during the file transfer"));
>          break;
> +    case VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE:
> +        error = g_error_new(SPICE_CLIENT_ERROR,
> SPICE_CLIENT_ERROR_FAILED,
> +                            "File transfer failed due to lack of
> free space on remote machine "
> +                            "(%lu B free, %lu B to transfer)",

for a nicer/human readable size output take a look at g_format_size()

Pavel

> +                            msg->data[0],
> +                            spice_file_transfer_task_get_total_byte
> s(xfer_task));
> +        break;
>      case VD_AGENT_FILE_XFER_STATUS_SUCCESS:
>          break;
>      default:
_______________________________________________
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]