[Spice-devel] [PATCH 15/18] Move ticketing_enabled to RedsState struct
Frediano Ziglio
fziglio at redhat.com
Mon Feb 1 16:49:25 CET 2016
>
> From: Jonathon Jongsma <jjongsma at redhat.com>
>
> Removing more global variables
> ---
> server/reds-private.h | 1 +
> server/reds.c | 10 +++++-----
> 2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/server/reds-private.h b/server/reds-private.h
> index 96dfa6a..15cf636 100644
> --- a/server/reds-private.h
> +++ b/server/reds-private.h
> @@ -216,6 +216,7 @@ struct RedsState {
> bool spice_uuid_is_set;
> uint8_t spice_uuid[16];
>
> + int ticketing_enabled;
> };
>
Why not using bool and true/false ?
> #endif
> diff --git a/server/reds.c b/server/reds.c
> index f21e92a..b23ec30 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -143,7 +143,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter
> = {
> #define REDS_TOKENS_TO_SEND 5
> #define REDS_VDI_PORT_NUM_RECEIVE_BUFFS 5
>
> -static int ticketing_enabled = 1; //Ticketing is enabled by default
> static pthread_mutex_t *lock_cs;
> static long *lock_count;
> uint32_t streaming_video = SPICE_STREAM_VIDEO_FILTER;
> @@ -1939,7 +1938,7 @@ static void reds_handle_ticket(void *opaque)
> }
> password[password_size] = '\0';
>
> - if (ticketing_enabled && !link->skip_auth) {
> + if (reds->ticketing_enabled && !link->skip_auth) {
> int expired = reds->taTicket.expiration_time < ltime;
>
> if (strlen(reds->taTicket.password) == 0) {
> @@ -2765,7 +2764,7 @@ static void reds_exit(void)
>
> static inline void on_activating_ticketing(RedsState *reds)
> {
> - if (!ticketing_enabled && reds_main_channel_connected(reds)) {
> + if (!reds->ticketing_enabled && reds_main_channel_connected(reds)) {
> spice_warning("disconnecting");
> reds_disconnect(reds);
> }
> @@ -3435,6 +3434,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
> #endif
> reds->spice_uuid_is_set = FALSE;
> memset(reds->spice_uuid, 0, sizeof(reds->spice_uuid));
> + reds->ticketing_enabled = TRUE; /* ticketing enabled by default */
> return reds;
> }
>
> @@ -3555,7 +3555,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_set_noauth(SpiceServer *s)
> {
> spice_assert(reds == s);
> memset(s->taTicket.password, 0, sizeof(s->taTicket.password));
> - ticketing_enabled = 0;
> + s->ticketing_enabled = 0;
> return 0;
> }
>
> @@ -3609,7 +3609,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_set_ticket(SpiceServer *reds,
> }
>
> on_activating_ticketing(reds);
> - ticketing_enabled = 1;
> + reds->ticketing_enabled = 1;
> if (lifetime == 0) {
> reds->taTicket.expiration_time = INT_MAX;
> } else {
Frediano
More information about the Spice-devel
mailing list