[PATCH 08/18] Move spice_listen_socket_fd to RedsState struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jonathon Jongsma <jjongsma@xxxxxxxxxx>

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;
 }
 
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]