diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/inputs-channel.c | 1 | ||||
-rw-r--r-- | server/main-channel.c | 3 | ||||
-rw-r--r-- | server/red-channel.c | 26 | ||||
-rw-r--r-- | server/red-channel.h | 19 | ||||
-rw-r--r-- | server/red-worker.c | 2 | ||||
-rw-r--r-- | server/sound.c | 4 | ||||
-rw-r--r-- | server/spicevmc.c | 2 |
7 files changed, 33 insertions, 24 deletions
diff --git a/server/inputs-channel.c b/server/inputs-channel.c index 9bb3f80f..058a8a86 100644 --- a/server/inputs-channel.c +++ b/server/inputs-channel.c @@ -641,6 +641,7 @@ InputsChannel* inputs_channel_new(void) inputs = (InputsChannel *)red_channel_create_parser( sizeof(InputsChannel), + reds, reds_get_core_interface(reds), SPICE_CHANNEL_INPUTS, 0, FALSE, /* handle_acks */ diff --git a/server/main-channel.c b/server/main-channel.c index 7a6656fa..e8c60f6a 100644 --- a/server/main-channel.c +++ b/server/main-channel.c @@ -1204,7 +1204,8 @@ MainChannel* main_channel_new(void) channel_cbs.handle_migrate_data = main_channel_handle_migrate_data; // TODO: set the migration flag of the channel - channel = red_channel_create_parser(sizeof(MainChannel), reds_get_core_interface(reds), + channel = red_channel_create_parser(sizeof(MainChannel), reds, + reds_get_core_interface(reds), SPICE_CHANNEL_MAIN, 0, FALSE, /* handle_acks */ spice_get_client_channel_parser(SPICE_CHANNEL_MAIN, NULL), diff --git a/server/red-channel.c b/server/red-channel.c index c0a5b42c..646b000b 100644 --- a/server/red-channel.c +++ b/server/red-channel.c @@ -1016,6 +1016,7 @@ void red_channel_client_default_migrate(RedChannelClient *rcc) } RedChannel *red_channel_create(int size, + RedsState *reds, const SpiceCoreInterface *core, uint32_t type, uint32_t id, int handle_acks, @@ -1039,6 +1040,7 @@ RedChannel *red_channel_create(int size, channel->migration_flags = migration_flags; memcpy(&channel->channel_cbs, channel_cbs, sizeof(ChannelCbs)); + channel->reds = reds; channel->core = core; ring_init(&channel->clients); @@ -1094,7 +1096,7 @@ SpiceCoreInterface dummy_core = { .watch_remove = dummy_watch_remove, }; -RedChannel *red_channel_create_dummy(int size, uint32_t type, uint32_t id) +RedChannel *red_channel_create_dummy(int size, RedsState *reds, uint32_t type, uint32_t id) { RedChannel *channel; ClientCbs client_cbs = { NULL, }; @@ -1104,6 +1106,7 @@ RedChannel *red_channel_create_dummy(int size, uint32_t type, uint32_t id) channel->type = type; channel->id = id; channel->refs = 1; + channel->reds = reds; channel->core = &dummy_core; ring_init(&channel->clients); client_cbs.connect = red_channel_client_default_connect; @@ -1131,15 +1134,16 @@ static int do_nothing_handle_message(RedChannelClient *rcc, } RedChannel *red_channel_create_parser(int size, - const SpiceCoreInterface *core, - uint32_t type, uint32_t id, - int handle_acks, - spice_parse_channel_func_t parser, - channel_handle_parsed_proc handle_parsed, - ChannelCbs *channel_cbs, - uint32_t migration_flags) -{ - RedChannel *channel = red_channel_create(size, core, type, id, + RedsState *reds, + const SpiceCoreInterface *core, + uint32_t type, uint32_t id, + int handle_acks, + spice_parse_channel_func_t parser, + channel_handle_parsed_proc handle_parsed, + ChannelCbs *channel_cbs, + uint32_t migration_flags) +{ + RedChannel *channel = red_channel_create(size, reds, core, type, id, handle_acks, do_nothing_handle_message, channel_cbs, @@ -1161,7 +1165,7 @@ void red_channel_set_stat_node(RedChannel *channel, StatNodeRef stat) #ifdef RED_STATISTICS channel->stat = stat; - channel->out_bytes_counter = reds_stat_add_counter(reds, stat, "out_bytes", TRUE); + channel->out_bytes_counter = reds_stat_add_counter(channel->reds, stat, "out_bytes", TRUE); #endif } diff --git a/server/red-channel.h b/server/red-channel.h index 5d0326e4..681d7e1c 100644 --- a/server/red-channel.h +++ b/server/red-channel.h @@ -343,6 +343,7 @@ struct RedChannel { // TODO: when different channel_clients are in different threads from Channel -> need to protect! pthread_t thread_id; + RedsState *reds; #ifdef RED_STATISTICS StatNodeRef stat; uint64_t *out_bytes_counter; @@ -365,6 +366,7 @@ struct RedChannel { /* if one of the callbacks should cause disconnect, use red_channel_shutdown and don't * explicitly destroy the channel */ RedChannel *red_channel_create(int size, + RedsState *reds, const SpiceCoreInterface *core, uint32_t type, uint32_t id, int handle_acks, @@ -375,13 +377,14 @@ RedChannel *red_channel_create(int size, /* alternative constructor, meant for marshaller based (inputs,main) channels, * will become default eventually */ RedChannel *red_channel_create_parser(int size, - const SpiceCoreInterface *core, - uint32_t type, uint32_t id, - int handle_acks, - spice_parse_channel_func_t parser, - channel_handle_parsed_proc handle_parsed, - ChannelCbs *channel_cbs, - uint32_t migration_flags); + RedsState *reds, + const SpiceCoreInterface *core, + uint32_t type, uint32_t id, + int handle_acks, + spice_parse_channel_func_t parser, + channel_handle_parsed_proc handle_parsed, + ChannelCbs *channel_cbs, + uint32_t migration_flags); void red_channel_set_stat_node(RedChannel *channel, StatNodeRef stat); void red_channel_register_client_cbs(RedChannel *channel, ClientCbs *client_cbs); @@ -398,7 +401,7 @@ RedChannelClient *red_channel_client_create(int size, RedChannel *channel, RedCl // TODO: tmp, for channels that don't use RedChannel yet (e.g., snd channel), but // do use the client callbacks. So the channel clients are not connected (the channel doesn't // have list of them, but they do have a link to the channel, and the client has a list of them) -RedChannel *red_channel_create_dummy(int size, uint32_t type, uint32_t id); +RedChannel *red_channel_create_dummy(int size, RedsState *reds, uint32_t type, uint32_t id); RedChannelClient *red_channel_client_create_dummy(int size, RedChannel *channel, RedClient *client, diff --git a/server/red-worker.c b/server/red-worker.c index 464c98b9..63b3aeeb 100644 --- a/server/red-worker.c +++ b/server/red-worker.c @@ -738,7 +738,7 @@ CommonChannel *red_worker_new_channel(RedWorker *worker, int size, channel_cbs->alloc_recv_buf = common_alloc_recv_buf; channel_cbs->release_recv_buf = common_release_recv_buf; - channel = red_channel_create_parser(size, &worker_core, + channel = red_channel_create_parser(size, reds, &worker_core, channel_type, worker->qxl->id, TRUE /* handle_acks */, spice_get_client_channel_parser(channel_type, NULL), diff --git a/server/sound.c b/server/sound.c index ca1e0ff4..f44eb479 100644 --- a/server/sound.c +++ b/server/sound.c @@ -1515,7 +1515,7 @@ void snd_attach_playback(SpicePlaybackInstance *sin) sin->st->frequency = SND_CODEC_CELT_PLAYBACK_FREQ; /* Default to the legacy rate */ // TODO: Make RedChannel base of worker? instead of assigning it to channel->data - channel = red_channel_create_dummy(sizeof(RedChannel), SPICE_CHANNEL_PLAYBACK, 0); + channel = red_channel_create_dummy(sizeof(RedChannel), reds, SPICE_CHANNEL_PLAYBACK, 0); channel->data = playback_worker; client_cbs.connect = snd_set_playback_peer; @@ -1546,7 +1546,7 @@ void snd_attach_record(SpiceRecordInstance *sin) sin->st->frequency = SND_CODEC_CELT_PLAYBACK_FREQ; /* Default to the legacy rate */ // TODO: Make RedChannel base of worker? instead of assigning it to channel->data - channel = red_channel_create_dummy(sizeof(RedChannel), SPICE_CHANNEL_RECORD, 0); + channel = red_channel_create_dummy(sizeof(RedChannel), reds, SPICE_CHANNEL_RECORD, 0); channel->data = record_worker; client_cbs.connect = snd_set_record_peer; diff --git a/server/spicevmc.c b/server/spicevmc.c index bc3d0321..f0809a55 100644 --- a/server/spicevmc.c +++ b/server/spicevmc.c @@ -519,7 +519,7 @@ SpiceCharDeviceState *spicevmc_device_connect(RedsState *reds, channel_cbs.handle_migrate_flush_mark = spicevmc_channel_client_handle_migrate_flush_mark; channel_cbs.handle_migrate_data = spicevmc_channel_client_handle_migrate_data; - state = (SpiceVmcState*)red_channel_create(sizeof(SpiceVmcState), + state = (SpiceVmcState*)red_channel_create(sizeof(SpiceVmcState), reds, reds_get_core_interface(reds), channel_type, id[channel_type]++, FALSE /* handle_acks */, spicevmc_red_channel_client_handle_message, |