summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2015-01-27 13:47:18 -0600
committerFabiano FidĂȘncio <fidencio@redhat.com>2015-02-23 23:00:45 +0100
commit6eebfc3f158fae09e3253ede07200fec8918b51f (patch)
tree39cea2bb6bcb7f28525888dd79b01e51a2c27777
parentdaf91d2ea687861eb544aa35f1806a74a2600234 (diff)
downloadspice-6eebfc3f158fae09e3253ede07200fec8918b51f.tar.gz
spice-6eebfc3f158fae09e3253ede07200fec8918b51f.tar.xz
spice-6eebfc3f158fae09e3253ede07200fec8918b51f.zip
Move spice_uuid, spice_uuid_is_set to RedsState struct
Removing more global variables
-rw-r--r--server/reds-private.h4
-rw-r--r--server/reds.c13
2 files changed, 10 insertions, 7 deletions
diff --git a/server/reds-private.h b/server/reds-private.h
index ceb7058f..c617e2ec 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -196,6 +196,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 95922f6f..d1c27dfe 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -89,9 +89,6 @@ SpiceCoreInterface *core = NULL;
#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;
@@ -1634,8 +1631,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);
}
@@ -3320,6 +3317,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;
}
@@ -3470,8 +3469,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,