[Spice-commits] 2 commits - server/reds.c server/reds-private.h
Frediano Ziglio
fziglio at kemper.freedesktop.org
Mon Feb 1 07:22:07 PST 2016
server/reds-private.h | 5 +++++
server/reds.c | 22 ++++++++++------------
2 files changed, 15 insertions(+), 12 deletions(-)
New commits:
commit c5ec8760f8834f8c60f3ebceaac2001a123a0469
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Tue Jan 27 13:47:18 2015 -0600
Move spice_uuid, spice_uuid_is_set to RedsState struct
Removing more global variables
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/reds-private.h b/server/reds-private.h
index b74c3a2..b154a92 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -207,6 +207,10 @@ struct RedsState {
char *sasl_appname;
#endif
char *spice_name;
+
+ bool spice_uuid_is_set;
+ uint8_t spice_uuid[16];
+
};
#endif
diff --git a/server/reds.c b/server/reds.c
index 5708efe..09fb56e 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -144,9 +144,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter = {
#define REDS_TOKENS_TO_SEND 5
#define REDS_VDI_PORT_NUM_RECEIVE_BUFFS 5
-static bool spice_uuid_is_set = FALSE;
-static uint8_t spice_uuid[16] = { 0, };
-
static int ticketing_enabled = 1; //Ticketing is enabled by default
static pthread_mutex_t *lock_cs;
static long *lock_count;
@@ -1705,8 +1702,8 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
red_dispatcher_qxl_ram_size());
if (reds->spice_name)
main_channel_push_name(mcc, reds->spice_name);
- if (spice_uuid_is_set)
- main_channel_push_uuid(mcc, spice_uuid);
+ if (reds->spice_uuid_is_set)
+ main_channel_push_uuid(mcc, reds->spice_uuid);
} else {
reds_mig_target_client_add(reds, client);
}
@@ -3434,6 +3431,8 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
#if HAVE_SASL
reds->sasl_appname = NULL; // default to "spice" if NULL
#endif
+ reds->spice_uuid_is_set = FALSE;
+ memset(reds->spice_uuid, 0, sizeof(reds->spice_uuid));
return reds;
}
@@ -3591,8 +3590,8 @@ SPICE_GNUC_VISIBLE void spice_server_set_name(SpiceServer *s, const char *name)
SPICE_GNUC_VISIBLE void spice_server_set_uuid(SpiceServer *s, const uint8_t uuid[16])
{
- memcpy(spice_uuid, uuid, sizeof(spice_uuid));
- spice_uuid_is_set = TRUE;
+ memcpy(s->spice_uuid, uuid, sizeof(s->spice_uuid));
+ s->spice_uuid_is_set = TRUE;
}
SPICE_GNUC_VISIBLE int spice_server_set_ticket(SpiceServer *s,
commit a826bcad4ebf0a48436d85507b99fdd115ab771b
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Tue Jan 27 13:45:04 2015 -0600
Move spice_name to RedsState struct
Remove more global variables
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/reds-private.h b/server/reds-private.h
index 484b296..b74c3a2 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -206,6 +206,7 @@ struct RedsState {
#if HAVE_SASL
char *sasl_appname;
#endif
+ char *spice_name;
};
#endif
diff --git a/server/reds.c b/server/reds.c
index 9a4ea3e..5708efe 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -144,7 +144,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter = {
#define REDS_TOKENS_TO_SEND 5
#define REDS_VDI_PORT_NUM_RECEIVE_BUFFS 5
-static char *spice_name = NULL;
static bool spice_uuid_is_set = FALSE;
static uint8_t spice_uuid[16] = { 0, };
@@ -1704,8 +1703,8 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
reds->mouse_mode, reds->is_client_mouse_allowed,
reds_get_mm_time() - MM_TIME_DELTA,
red_dispatcher_qxl_ram_size());
- if (spice_name)
- main_channel_push_name(mcc, spice_name);
+ if (reds->spice_name)
+ main_channel_push_name(mcc, reds->spice_name);
if (spice_uuid_is_set)
main_channel_push_uuid(mcc, spice_uuid);
} else {
@@ -3586,8 +3585,8 @@ SPICE_GNUC_VISIBLE int spice_server_set_sasl_appname(SpiceServer *s, const char
SPICE_GNUC_VISIBLE void spice_server_set_name(SpiceServer *s, const char *name)
{
- free(spice_name);
- spice_name = spice_strdup(name);
+ free(s->spice_name);
+ s->spice_name = spice_strdup(name);
}
SPICE_GNUC_VISIBLE void spice_server_set_uuid(SpiceServer *s, const uint8_t uuid[16])
More information about the Spice-commits
mailing list