[Spice-devel] [PATCH spice-html5 1/2] main: Add messages for file transfer detailed errors
Jeremy White
jwhite at codeweavers.com
Fri Sep 15 18:13:03 UTC 2017
Hi Tomáš,
On 09/06/2017 03:52 AM, Tomáš Bohdálek wrote:
> ---
> enums.js | 12 ++++++++++--
> main.js | 16 +++++++++++++++-
> spicemsg.js | 4 ++++
> 3 files changed, 29 insertions(+), 3 deletions(-)
>
> diff --git a/enums.js b/enums.js
> index d5a9003..7154595 100644
> --- a/enums.js
> +++ b/enums.js
> @@ -369,12 +369,20 @@ var VD_AGENT_CAP_MOUSE_STATE = 0,
> VD_AGENT_CAP_GUEST_LINEEND_LF = 8,
> VD_AGENT_CAP_GUEST_LINEEND_CRLF = 9,
> VD_AGENT_CAP_MAX_CLIPBOARD = 10,
> - VD_AGENT_END_CAP = 11;
> + VD_AGENT_CAP_AUDIO_VOLUME_SYNC = 11,
> + VD_AGENT_CAP_MONITORS_CONFIG_POSITION = 12,
> + VD_AGENT_CAP_FILE_XFER_DISABLED = 13,
> + VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS = 14,
> + VD_AGENT_END_CAP = 15;
>
> var VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA = 0,
> VD_AGENT_FILE_XFER_STATUS_CANCELLED = 1,
> VD_AGENT_FILE_XFER_STATUS_ERROR = 2,
> - VD_AGENT_FILE_XFER_STATUS_SUCCESS = 3;
> + VD_AGENT_FILE_XFER_STATUS_SUCCESS = 3,
> + VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE = 4,
> + VD_AGENT_FILE_XFER_STATUS_SESSION_LOCKED = 5,
> + VD_AGENT_FILE_XFER_STATUS_AGENT_NOT_CONNECTED = 6,
> + VD_AGENT_FILE_XFER_STATUS_DISABLED = 7;
>
> var SPICE_STREAM_FLAGS_TOP_DOWN = (1 << 0);
This bit does not apply for me, as the master does appear to have that
top down flag.
>
> diff --git a/main.js b/main.js
> index 173ff97..0237f0e 100644
> --- a/main.js
> +++ b/main.js
> @@ -344,7 +344,8 @@ SpiceMainConn.prototype.announce_agent_capabilities = function(request)
> {
> var caps = new VDAgentAnnounceCapabilities(request, (1 << VD_AGENT_CAP_MOUSE_STATE) |
> (1 << VD_AGENT_CAP_MONITORS_CONFIG) |
> - (1 << VD_AGENT_CAP_REPLY));
> + (1 << VD_AGENT_CAP_REPLY) |
> + (1 << VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS));
> this.send_agent_message(VD_AGENT_ANNOUNCE_CAPABILITIES, caps);
> }
>
> @@ -387,11 +388,24 @@ SpiceMainConn.prototype.handle_file_xfer_status = function(file_xfer_status)
> break;
> case VD_AGENT_FILE_XFER_STATUS_SUCCESS:
> break;
> + case VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE:
> + xfer_error = "not enough space in the remote system";
> + break;
> + case VD_AGENT_FILE_XFER_STATUS_SESSION_LOCKED:
> + xfer_error = "remote system is locked";
> + break;
> + case VD_AGENT_FILE_XFER_STATUS_AGENT_NOT_CONNECTED:
> + xfer_error = "spice angent is not connected";
> + break;
> + case VD_AGENT_FILE_XFER_STATUS_DISABLED:
> + xfer_error = "file transfer is disabled on the remote system";
> + break;
> default:
> xfer_error = "unhandled status type: " + file_xfer_status.result;
> break;
> }
>
> + xfer_error = "File transfer: " + xfer_error;
> this.file_xfer_completed(xfer_task, xfer_error)
Question: What do we display on success? It seems like it might be an
opportunity to put in a nicer message.
> }
>
> diff --git a/spicemsg.js b/spicemsg.js
> index 3619996..7ebc64b 100644
> --- a/spicemsg.js
> +++ b/spicemsg.js
> @@ -577,6 +577,10 @@ VDAgentFileXferStatusMessage.prototype =
> var dv = new SpiceDataView(a);
> this.id = dv.getUint32(at, true); at += 4;
> this.result = dv.getUint32(at, true); at += 4;
> + if (this.result >= VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE)
Shouldn't that be '==', not '>=' ?
> + {
> + this.data = dv.getUint64(at, true); at += 8;
> + }
Cheers,
Jeremy
More information about the Spice-devel
mailing list