[Spice-devel] [PATCH 13/16] Move spice_port to RedsState struct

Pavel Grunt pgrunt at redhat.com
Fri Jan 29 02:04:09 PST 2016


On Wed, 2016-01-27 at 12:48 +0000, Frediano Ziglio wrote:
> From: Jonathon Jongsma <jjongsma at redhat.com>
> 
> Remove another global variable
Acked-by: Pavel Grunt <pgrunt at redhat.com>
> ---
>  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 7a3b524..7f1a6df 100644
> --- a/server/reds-private.h
> +++ b/server/reds-private.h
> @@ -198,6 +198,7 @@ struct RedsState {
>      const char *default_renderer;
>      GArray *renderers;
>  
> +    int spice_port;
>  };
>  
>  #endif
> diff --git a/server/reds.c b/server/reds.c
> index c671e7a..dfde212 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -149,7 +149,6 @@ static SpiceMigrateInstance *migration_interface
> = NULL;
>  
>  static TicketAuthentication taTicket;
>  
> -static int spice_port = -1;
>  static int spice_secure_port = -1;
>  static int spice_listen_socket_fd = -1;
>  static char spice_addr[256];
> @@ -2568,8 +2567,8 @@ void reds_set_client_mm_time_latency(RedsState
> *reds, RedClient *client, uint32_
>  
>  static int reds_init_net(RedsState *reds)
>  {
> -    if (spice_port != -1 || spice_family == AF_UNIX) {
> -        reds->listen_socket = reds_init_socket(spice_addr,
> spice_port, spice_family);
> +    if (reds->spice_port != -1 || spice_family == AF_UNIX) {
> +        reds->listen_socket = reds_init_socket(spice_addr, reds-
> >spice_port, spice_family);
>          if (-1 == reds->listen_socket) {
>              return -1;
>          }
> @@ -3447,6 +3446,7 @@ SPICE_GNUC_VISIBLE SpiceServer
> *spice_server_new(void)
>          SPICE_CHANNEL_SECURITY_NONE | SPICE_CHANNEL_SECURITY_SSL;
>      reds->default_renderer = "sw";
>      reds->renderers = g_array_sized_new(FALSE, TRUE,
> sizeof(uint32_t), RED_RENDERER_LAST);
> +    reds->spice_port = -1;
>      return reds;
>  }
>  
> @@ -3528,7 +3528,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_set_port(SpiceServer *s, int port)
>      if (port < 0 || port > 0xffff) {
>          return -1;
>      }
> -    spice_port = port;
> +    s->spice_port = port;
>      return 0;
>  }
>  


More information about the Spice-devel mailing list