[Spice-devel] [PATCH spice-server v2 1/3] Refactor agent_adjust_capabilities() function

Christophe Fergeau cfergeau at redhat.com
Wed Mar 6 15:35:18 UTC 2019


Series looks good to me,

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Mon, Mar 04, 2019 at 01:50:43PM -0600, Jonathon Jongsma wrote:
> Make this a RedsState member function rather than a standalone function.
> This means that we simply pass RedsState* as an argument rather than the
> internal member variables of RedsState. This enables the following
> commit which handles the VD_AGENT_CAP_GRAPHICS_DEVICE_INFO capability to
> avoid sending graphics device info to agents that do not support it.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---
>  server/reds.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/server/reds.c b/server/reds.c
> index 2e5c69e60..63bfadb22 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -793,8 +793,9 @@ static void vdi_port_read_buf_free(RedPipeItem *base)
>      g_free(buf);
>  }
>  
> -static void agent_adjust_capabilities(VDAgentMessage *message,
> -                                      bool clipboard_enabled, bool xfer_enabled)
> +/* certain agent capabilities can be overridden and disabled in the server. In these cases, unset
> + * these capabilities before sending them on to the client */
> +static void reds_adjust_agent_capabilities(RedsState *reds, VDAgentMessage *message)
>  {
>      VDAgentAnnounceCapabilities *capabilities;
>  
> @@ -803,13 +804,13 @@ static void agent_adjust_capabilities(VDAgentMessage *message,
>      }
>      capabilities = (VDAgentAnnounceCapabilities *) message->data;
>  
> -    if (!clipboard_enabled) {
> +    if (!reds->config->agent_copypaste) {
>          VD_AGENT_CLEAR_CAPABILITY(capabilities->caps, VD_AGENT_CAP_CLIPBOARD);
>          VD_AGENT_CLEAR_CAPABILITY(capabilities->caps, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND);
>          VD_AGENT_CLEAR_CAPABILITY(capabilities->caps, VD_AGENT_CAP_CLIPBOARD_SELECTION);
>      }
>  
> -    if (!xfer_enabled) {
> +    if (!reds->config->agent_file_xfer) {
>          VD_AGENT_SET_CAPABILITY(capabilities->caps, VD_AGENT_CAP_FILE_XFER_DISABLED);
>      }
>  }
> @@ -879,9 +880,7 @@ static RedPipeItem *vdi_port_read_one_msg_from_device(RedCharDevice *self,
>              }
>              switch (vdi_port_read_buf_process(dev, dispatch_buf)) {
>              case AGENT_MSG_FILTER_OK:
> -                agent_adjust_capabilities((VDAgentMessage *) dispatch_buf->data,
> -                                          reds->config->agent_copypaste,
> -                                          reds->config->agent_file_xfer);
> +                reds_adjust_agent_capabilities(reds, (VDAgentMessage *) dispatch_buf->data);
>                  return &dispatch_buf->base;
>              case AGENT_MSG_FILTER_PROTO_ERROR:
>                  reds_agent_remove(reds);
> @@ -1380,9 +1379,7 @@ void reds_on_main_channel_migrate(RedsState *reds, MainChannelClient *mcc)
>          read_buf->len = read_data_len;
>          switch (vdi_port_read_buf_process(agent_dev, read_buf)) {
>          case AGENT_MSG_FILTER_OK:
> -            agent_adjust_capabilities((VDAgentMessage *)read_buf->data,
> -                                      reds->config->agent_copypaste,
> -                                      reds->config->agent_file_xfer);
> +            reds_adjust_agent_capabilities(reds, (VDAgentMessage *)read_buf->data);
>              main_channel_client_push_agent_data(mcc,
>                                                  read_buf->data,
>                                                  read_buf->len,
> -- 
> 2.17.2
> 
> _______________________________________________
> 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/20190306/25ef8ffa/attachment.sig>


More information about the Spice-devel mailing list