From: Jonathon Jongsma <jjongsma@xxxxxxxxxx> Removing more global variables --- server/reds-private.h | 1 + server/reds.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/server/reds-private.h b/server/reds-private.h index 87645df..6d36065 100644 --- a/server/reds-private.h +++ b/server/reds-private.h @@ -204,6 +204,7 @@ struct RedsState { SpiceMigrateInstance *migration_interface; int spice_listen_socket_fd; char spice_addr[256]; + int spice_family; }; #endif diff --git a/server/reds.c b/server/reds.c index f1b3c54..d346b1b 100644 --- a/server/reds.c +++ b/server/reds.c @@ -145,7 +145,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter = { static TicketAuthentication taTicket; -static int spice_family = PF_UNSPEC; static int sasl_enabled = 0; // sasl disabled by default #if HAVE_SASL static char *sasl_appname = NULL; // default to "spice" if NULL @@ -2559,8 +2558,8 @@ void reds_set_client_mm_time_latency(RedsState *reds, RedClient *client, uint32_ static int reds_init_net(RedsState *reds) { - if (reds->spice_port != -1 || spice_family == AF_UNIX) { - reds->listen_socket = reds_init_socket(reds->spice_addr, reds->spice_port, spice_family); + if (reds->spice_port != -1 || reds->spice_family == AF_UNIX) { + reds->listen_socket = reds_init_socket(reds->spice_addr, reds->spice_port, reds->spice_family); if (-1 == reds->listen_socket) { return -1; } @@ -2575,7 +2574,7 @@ static int reds_init_net(RedsState *reds) if (reds->spice_secure_port != -1) { reds->secure_listen_socket = reds_init_socket(reds->spice_addr, reds->spice_secure_port, - spice_family); + reds->spice_family); if (-1 == reds->secure_listen_socket) { return -1; } @@ -3439,6 +3438,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void) reds->spice_port = -1; reds->spice_secure_port = -1; reds->spice_listen_socket_fd = -1; + reds->spice_family = PF_UNSPEC; return reds; } @@ -3531,11 +3531,11 @@ SPICE_GNUC_VISIBLE void spice_server_set_addr(SpiceServer *s, const char *addr, g_strlcpy(s->spice_addr, addr, sizeof(s->spice_addr)); if (flags == SPICE_ADDR_FLAG_IPV4_ONLY) { - spice_family = PF_INET; + s->spice_family = PF_INET; } else if (flags == SPICE_ADDR_FLAG_IPV6_ONLY) { - spice_family = PF_INET6; + s->spice_family = PF_INET6; } else if (flags == SPICE_ADDR_FLAG_UNIX_ONLY) { - spice_family = AF_UNIX; + s->spice_family = AF_UNIX; } else if (flags != 0) { spice_warning("unknown address flag: 0x%X", flags); } -- 2.4.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel