[Spice-devel] [PATCH 08/18] Move spice_listen_socket_fd to RedsState struct

Frediano Ziglio fziglio at redhat.com
Mon Feb 1 14:50:25 CET 2016


> 
> From: Jonathon Jongsma <jjongsma at redhat.com>
> 
> Removing more global variables
> ---
>  server/reds-private.h | 1 +
>  server/reds.c         | 8 ++++----
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/server/reds-private.h b/server/reds-private.h
> index 6ce02f9..f6cd16b 100644
> --- a/server/reds-private.h
> +++ b/server/reds-private.h
> @@ -202,6 +202,7 @@ struct RedsState {
>      int spice_secure_port;
>      SpiceCharDeviceInstance *vdagent;
>      SpiceMigrateInstance *migration_interface;
> +    int spice_listen_socket_fd;
>  };
>  
>  #endif
> diff --git a/server/reds.c b/server/reds.c
> index ad4eb94..9108847 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -145,7 +145,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter
> = {
>  
>  static TicketAuthentication taTicket;
>  
> -static int spice_listen_socket_fd = -1;
>  static char spice_addr[256];
>  static int spice_family = PF_UNSPEC;
>  static int sasl_enabled = 0; // sasl disabled by default
> @@ -2590,8 +2589,8 @@ static int reds_init_net(RedsState *reds)
>          }
>      }
>  
> -    if (spice_listen_socket_fd != -1 ) {
> -        reds->listen_socket = spice_listen_socket_fd;
> +    if (reds->spice_listen_socket_fd != -1 ) {
> +        reds->listen_socket = reds->spice_listen_socket_fd;
>          reds->listen_watch = core->watch_add(core, reds->listen_socket,
>                                               SPICE_WATCH_EVENT_READ,
>                                               reds_accept, NULL);
> @@ -3440,6 +3439,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
>      reds->renderers = g_array_sized_new(FALSE, TRUE, sizeof(uint32_t),
>      RED_RENDERER_LAST);
>      reds->spice_port = -1;
>      reds->spice_secure_port = -1;
> +    reds->spice_listen_socket_fd = -1;
>      return reds;
>  }
>  
> @@ -3545,7 +3545,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_set_addr(SpiceServer *s, const char *addr,
>  SPICE_GNUC_VISIBLE int spice_server_set_listen_socket_fd(SpiceServer *s, int
>  listen_fd)
>  {
>      spice_assert(reds == s);
> -    spice_listen_socket_fd = listen_fd;
> +    s->spice_listen_socket_fd = listen_fd;
>      return 0;
>  }
>  

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

Frediano


More information about the Spice-devel mailing list