From: Jonathon Jongsma <jjongsma@xxxxxxxxxx> Allows client methods to not use global 'reds' variable --- server/red-channel.c | 5 +++-- server/red-channel.h | 3 ++- server/reds.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/server/red-channel.c b/server/red-channel.c index 1ca85b1..1db68ef 100644 --- a/server/red-channel.c +++ b/server/red-channel.c @@ -2046,11 +2046,12 @@ void red_channel_client_pipe_remove_and_release(RedChannelClient *rcc, * pretty tied together. */ -RedClient *red_client_new(int migrated) +RedClient *red_client_new(RedsState *reds, int migrated) { RedClient *client; client = spice_malloc0(sizeof(RedClient)); + client->reds = reds; ring_init(&client->channels); pthread_mutex_init(&client->lock, NULL); client->thread_id = pthread_self(); @@ -2212,7 +2213,7 @@ void red_client_semi_seamless_migrate_complete(RedClient *client) } } pthread_mutex_unlock(&client->lock); - reds_on_client_semi_seamless_migrate_complete(reds, client); + reds_on_client_semi_seamless_migrate_complete(client->reds, client); } /* should be called only from the main thread */ diff --git a/server/red-channel.h b/server/red-channel.h index 791bc5b..4bd4136 100644 --- a/server/red-channel.h +++ b/server/red-channel.h @@ -564,6 +564,7 @@ typedef void (*channel_client_callback_data)(RedChannelClient *rcc, void *data); void red_channel_apply_clients(RedChannel *channel, channel_client_callback v); struct RedClient { + RedsState *reds; RingItem link; Ring channels; int channels_num; @@ -585,7 +586,7 @@ struct RedClient { int refs; }; -RedClient *red_client_new(int migrated); +RedClient *red_client_new(RedsState *reds, int migrated); /* * disconnects all the client's channels (should be called from the client's thread) diff --git a/server/reds.c b/server/reds.c index b30c4c6..fe35d84 100644 --- a/server/reds.c +++ b/server/reds.c @@ -1647,7 +1647,7 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link) link->link_mess = NULL; reds_link_free(link); caps = (uint32_t *)((uint8_t *)link_mess + link_mess->caps_offset); - client = red_client_new(mig_target); + client = red_client_new(reds, mig_target); ring_add(&reds->clients, &client->link); reds->num_clients++; mcc = main_channel_link(reds->main_channel, client, -- 2.5.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel