[Spice-devel] [PATCH 09/18] Move spice_addr to RedsState struct

Frediano Ziglio fziglio at redhat.com
Fri Jan 29 04:02:05 PST 2016


From: Jonathon Jongsma <jjongsma at redhat.com>

Removing more global variables
---
 server/reds-private.h | 1 +
 server/reds.c         | 7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/reds-private.h b/server/reds-private.h
index f6cd16b..87645df 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -203,6 +203,7 @@ struct RedsState {
     SpiceCharDeviceInstance *vdagent;
     SpiceMigrateInstance *migration_interface;
     int spice_listen_socket_fd;
+    char spice_addr[256];
 };
 
 #endif
diff --git a/server/reds.c b/server/reds.c
index 9108847..f1b3c54 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -145,7 +145,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter = {
 
 static TicketAuthentication taTicket;
 
-static char spice_addr[256];
 static int spice_family = PF_UNSPEC;
 static int sasl_enabled = 0; // sasl disabled by default
 #if HAVE_SASL
@@ -2561,7 +2560,7 @@ 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(spice_addr, reds->spice_port, spice_family);
+        reds->listen_socket = reds_init_socket(reds->spice_addr, reds->spice_port, 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(spice_addr, reds->spice_secure_port,
+        reds->secure_listen_socket = reds_init_socket(reds->spice_addr, reds->spice_secure_port,
                                                       spice_family);
         if (-1 == reds->secure_listen_socket) {
             return -1;
@@ -3529,7 +3528,7 @@ SPICE_GNUC_VISIBLE void spice_server_set_addr(SpiceServer *s, const char *addr,
 {
     spice_assert(reds == s);
 
-    g_strlcpy(spice_addr, addr, sizeof(spice_addr));
+    g_strlcpy(s->spice_addr, addr, sizeof(s->spice_addr));
 
     if (flags == SPICE_ADDR_FLAG_IPV4_ONLY) {
         spice_family = PF_INET;
-- 
2.4.3



More information about the Spice-devel mailing list