[Spice-devel] [PATCH 10/18] Move agent_file_xfer to RedsState struct

Frediano Ziglio fziglio at redhat.com
Wed Feb 3 15:48:28 CET 2016


> 
> From: Jonathon Jongsma <jjongsma at redhat.com>
> 
> Removing more global variables
> ---
>  server/reds-private.h |  1 +
>  server/reds.c         | 16 ++++++++--------
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/server/reds-private.h b/server/reds-private.h
> index 52f88f8..9c3db70 100644
> --- a/server/reds-private.h
> +++ b/server/reds-private.h
> @@ -223,6 +223,7 @@ struct RedsState {
>  
>      gboolean agent_mouse;
>      gboolean agent_copypaste;
> +    gboolean agent_file_xfer;
>  };
>  
>  #endif
> diff --git a/server/reds.c b/server/reds.c
> index b7c04e4..f3268d6 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -146,7 +146,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter
> = {
>  
>  static pthread_mutex_t *lock_cs;
>  static long *lock_count;
> -int agent_file_xfer = TRUE;
>  static bool exit_on_disconnect = FALSE;
>  
>  RedsState *reds = NULL;
> @@ -414,7 +413,7 @@ static void reds_reset_vdp(RedsState *reds)
>      }
>      /* Reset read filter to start with clean state when the agent reconnects
>      */
>      agent_msg_filter_init(&state->read_filter, reds->agent_copypaste,
> -                          agent_file_xfer, TRUE);
> +                          reds->agent_file_xfer, TRUE);
>      /* Throw away pending chunks from the current (if any) and future
>       * messages written by the client.
>       * TODO: client should clear its agent messages queue when the agent
> @@ -528,7 +527,7 @@ void reds_client_disconnect(RedsState *reds, RedClient
> *client)
>  
>          /* Reset write filter to start with clean state on client reconnect
>          */
>          agent_msg_filter_init(&reds->agent_state.write_filter,
>          reds->agent_copypaste,
> -                              agent_file_xfer, TRUE);
> +                              reds->agent_file_xfer, TRUE);
>  
>          /* Throw away pending chunks from the current (if any) and future
>           *  messages read from the agent */
> @@ -3293,9 +3292,9 @@ static void reds_init_vd_agent_resources(RedsState
> *reds)
>  
>      ring_init(&state->read_bufs);
>      agent_msg_filter_init(&state->write_filter, reds->agent_copypaste,
> -                          agent_file_xfer, TRUE);
> +                          reds->agent_file_xfer, TRUE);
>      agent_msg_filter_init(&state->read_filter, reds->agent_copypaste,
> -                          agent_file_xfer, TRUE);
> +                          reds->agent_file_xfer, TRUE);
>  
>      state->read_state = VDI_PORT_READ_STATE_READ_HEADER;
>      state->receive_pos = (uint8_t *)&state->vdi_chunk_header;
> @@ -3428,6 +3427,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
>      reds->zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
>      reds->agent_mouse = TRUE;
>      reds->agent_copypaste = TRUE;
> +    reds->agent_file_xfer = TRUE;
>      return reds;
>  }
>  
> @@ -3819,9 +3819,9 @@ SPICE_GNUC_VISIBLE int
> spice_server_set_agent_copypaste(SpiceServer *s, int enab
>  SPICE_GNUC_VISIBLE int spice_server_set_agent_file_xfer(SpiceServer *s, int
>  enable)
>  {
>      spice_assert(reds == s);
> -    agent_file_xfer = enable;
> -    reds->agent_state.write_filter.file_xfer_enabled = agent_file_xfer;
> -    reds->agent_state.read_filter.file_xfer_enabled = agent_file_xfer;
> +    s->agent_file_xfer = enable;
> +    reds->agent_state.write_filter.file_xfer_enabled = s->agent_file_xfer;
> +    reds->agent_state.read_filter.file_xfer_enabled = s->agent_file_xfer;
>      return 0;
>  }
>  

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Frediano


More information about the Spice-devel mailing list