[Spice-devel] [PATCH spice-vdagent v3] file-xfer: Send more detailed error messages

Victor Toso victortoso at redhat.com
Fri Jun 30 15:21:22 UTC 2017


Hi,

On Tue, Jun 06, 2017 at 11:22:37PM +0200, Jakub Janků wrote:
> Send VD_AGENT_FILE_XFER_STATUS_VDAGENT_NOT_CONNECTED,
> VD_AGENT_FILE_XFER_STATUS_SESSION_LOCKED or
> VD_AGENT_FILE_XFER_STATUS_DISABLED instead of general error, when the
> given error occurs.
> 
> send_file_xfer_status() ensures, these errors are sent only to clients with
> VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS capability.

Acked-by: Victor Toso <victortoso at redhat.com>

and pushed:

commit 78c930e758082ed351a5e9b1d50a2515d642cb08
Author: Jakub Janků <janku.jakub.jj at gmail.com>
file-xfer: Send more detailed error messages

Sorry for the delay and thank you for the patches!

Cheers,

> ---
>  src/vdagent/file-xfers.c | 4 ++--
>  src/vdagent/file-xfers.h | 2 +-
>  src/vdagent/vdagent.c    | 9 +++------
>  src/vdagentd/vdagentd.c  | 8 ++++++--
>  4 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/src/vdagent/file-xfers.c b/src/vdagent/file-xfers.c
> index 51fccd7..344db6b 100644
> --- a/src/vdagent/file-xfers.c
> +++ b/src/vdagent/file-xfers.c
> @@ -356,10 +356,10 @@ void vdagent_file_xfers_data(struct vdagent_file_xfers *xfers,
>      }
>  }
>  
> -void vdagent_file_xfers_error(struct udscs_connection *vdagentd, uint32_t msg_id)
> +void vdagent_file_xfers_error_disabled(struct udscs_connection *vdagentd, uint32_t msg_id)
>  {
>      g_return_if_fail(vdagentd != NULL);
>  
>      udscs_write(vdagentd, VDAGENTD_FILE_XFER_STATUS,
> -                msg_id, VD_AGENT_FILE_XFER_STATUS_ERROR, NULL, 0);
> +                msg_id, VD_AGENT_FILE_XFER_STATUS_DISABLED, NULL, 0);
>  }
> diff --git a/src/vdagent/file-xfers.h b/src/vdagent/file-xfers.h
> index 28a71fd..3e2ed1d 100644
> --- a/src/vdagent/file-xfers.h
> +++ b/src/vdagent/file-xfers.h
> @@ -37,7 +37,7 @@ void vdagent_file_xfers_status(struct vdagent_file_xfers *xfers,
>      VDAgentFileXferStatusMessage *msg);
>  void vdagent_file_xfers_data(struct vdagent_file_xfers *xfers,
>      VDAgentFileXferDataMessage *msg);
> -void vdagent_file_xfers_error(struct udscs_connection *vdagentd,
> +void vdagent_file_xfers_error_disabled(struct udscs_connection *vdagentd,
>      uint32_t msg_id);
>  
>  #endif
> diff --git a/src/vdagent/vdagent.c b/src/vdagent/vdagent.c
> index 6f025e8..5246b0c 100644
> --- a/src/vdagent/vdagent.c
> +++ b/src/vdagent/vdagent.c
> @@ -89,8 +89,7 @@ static void daemon_read_complete(struct udscs_connection **connp,
>              vdagent_file_xfers_start(vdagent_file_xfers,
>                                       (VDAgentFileXferStartMessage *)data);
>          } else {
> -            vdagent_file_xfers_error(*connp,
> -                                     ((VDAgentFileXferStartMessage *)data)->id);
> +            vdagent_file_xfers_error_disabled(*connp, ((VDAgentFileXferStartMessage *)data)->id);
>          }
>          break;
>      case VDAGENTD_FILE_XFER_STATUS:
> @@ -98,8 +97,7 @@ static void daemon_read_complete(struct udscs_connection **connp,
>              vdagent_file_xfers_status(vdagent_file_xfers,
>                                        (VDAgentFileXferStatusMessage *)data);
>          } else {
> -            vdagent_file_xfers_error(*connp,
> -                                     ((VDAgentFileXferStatusMessage *)data)->id);
> +            vdagent_file_xfers_error_disabled(*connp, ((VDAgentFileXferStatusMessage *)data)->id);
>          }
>          break;
>      case VDAGENTD_FILE_XFER_DISABLE:
> @@ -125,8 +123,7 @@ static void daemon_read_complete(struct udscs_connection **connp,
>              vdagent_file_xfers_data(vdagent_file_xfers,
>                                      (VDAgentFileXferDataMessage *)data);
>          } else {
> -            vdagent_file_xfers_error(*connp,
> -                                     ((VDAgentFileXferDataMessage *)data)->id);
> +            vdagent_file_xfers_error_disabled(*connp, ((VDAgentFileXferDataMessage *)data)->id);
>          }
>          break;
>      case VDAGENTD_CLIENT_DISCONNECTED:
> diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
> index 46dfb4e..0465d3a 100644
> --- a/src/vdagentd/vdagentd.c
> +++ b/src/vdagentd/vdagentd.c
> @@ -349,14 +349,14 @@ static void do_client_file_xfer(struct vdagent_virtio_port *vport,
>              send_file_xfer_status(vport,
>                 "Could not find an agent connection belonging to the "
>                 "active session, cancelling file-xfer",
> -               s->id, VD_AGENT_FILE_XFER_STATUS_CANCELLED, NULL, 0);
> +               s->id, VD_AGENT_FILE_XFER_STATUS_VDAGENT_NOT_CONNECTED, NULL, 0);
>              return;
>          } else if (session_info_session_is_locked(session_info)) {
>              syslog(LOG_DEBUG, "Session is locked, skipping file-xfer-start");
>              send_file_xfer_status(vport,
>                 "User's session is locked and cannot start file transfer. "
>                 "Cancelling file-xfer",
> -               s->id, VD_AGENT_FILE_XFER_STATUS_ERROR, NULL, 0);
> +               s->id, VD_AGENT_FILE_XFER_STATUS_SESSION_LOCKED, NULL, 0);
>              return;
>          }
>          udscs_write(active_session_conn, VDAGENTD_FILE_XFER_START, 0, 0,
> @@ -930,6 +930,10 @@ static void agent_read_complete(struct udscs_connection **connp,
>                                        (uint8_t*)&free_space, sizeof(uint64_t));
>                  break;
>              }
> +            case VD_AGENT_FILE_XFER_STATUS_DISABLED:
> +                send_file_xfer_status(virtio_port, "File-xfer is disabled, cancelling",
> +                                      header->arg1, header->arg2, NULL, 0);
> +                break;
>              default:
>                  send_file_xfer_status(virtio_port, NULL, header->arg1, header->arg2, NULL, 0);
>          }
> -- 
> 2.9.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170630/960d5848/attachment.sig>


More information about the Spice-devel mailing list