diff options
author | Alon Levy <alevy@redhat.com> | 2010-11-04 17:21:46 +0200 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-02-07 19:22:44 +0200 |
commit | 194a6be5f78cb04a1891d2f74efbab828dab3d39 (patch) | |
tree | 6c3af926738deeb15e169c292a53a23b20a102e2 /server | |
parent | 7dfd7a0c779da2df2c90ea59a9defb313779aaca (diff) | |
download | spice-194a6be5f78cb04a1891d2f74efbab828dab3d39.tar.gz spice-194a6be5f78cb04a1891d2f74efbab828dab3d39.tar.xz spice-194a6be5f78cb04a1891d2f74efbab828dab3d39.zip |
server/red_channel: add red_channel_pipe_add_push
Diffstat (limited to 'server')
-rw-r--r-- | server/inputs_channel.c | 8 | ||||
-rw-r--r-- | server/main_channel.c | 30 | ||||
-rw-r--r-- | server/red_channel.c | 7 | ||||
-rw-r--r-- | server/red_channel.h | 1 | ||||
-rw-r--r-- | server/smartcard.c | 10 |
5 files changed, 32 insertions, 24 deletions
diff --git a/server/inputs_channel.c b/server/inputs_channel.c index 9b6c7913..9372c6f2 100644 --- a/server/inputs_channel.c +++ b/server/inputs_channel.c @@ -243,7 +243,7 @@ static void inputs_pipe_add_type(InputsChannel *channel, int type) { InputsPipeItem* pipe_item = inputs_pipe_item_new(channel, type); - red_channel_pipe_add(&channel->base, &pipe_item->base); + red_channel_pipe_add_push(&channel->base, &pipe_item->base); } static void inputs_channel_release_pipe_item(RedChannel *channel, @@ -476,7 +476,7 @@ static void inputs_migrate(Channel *channel) ASSERT(g_inputs_channel == (InputsChannel *)channel->data); item = inputs_pipe_item_new(inputs_channel, PIPE_ITEM_MIGRATE); - red_channel_pipe_add(&inputs_channel->base, &item->base); + red_channel_pipe_add_push(&inputs_channel->base, &item->base); } static void inputs_pipe_add_init(InputsChannel *inputs_channel) @@ -486,7 +486,7 @@ static void inputs_pipe_add_init(InputsChannel *inputs_channel) red_channel_pipe_item_init(&inputs_channel->base, &item->base, PIPE_ITEM_INIT); item->modifiers = kbd_get_leds(keyboard); - red_channel_pipe_add(&inputs_channel->base, &item->base); + red_channel_pipe_add_push(&inputs_channel->base, &item->base); } static int inputs_channel_config_socket(RedChannel *channel) @@ -545,7 +545,7 @@ static void inputs_push_keyboard_modifiers(uint8_t modifiers) return; } item = inputs_key_modifiers_item_new(g_inputs_channel, modifiers); - red_channel_pipe_add(&g_inputs_channel->base, &item->base); + red_channel_pipe_add_push(&g_inputs_channel->base, &item->base); } void inputs_on_keyboard_leds_change(void *opaque, uint8_t leds) diff --git a/server/main_channel.c b/server/main_channel.c index 1abf107a..626189b3 100644 --- a/server/main_channel.c +++ b/server/main_channel.c @@ -277,7 +277,7 @@ static void main_channel_push_channels(MainChannel *main_chan) RedsOutItem *item; item = main_pipe_item_new(main_chan, SPICE_MSG_MAIN_CHANNELS_LIST); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static void main_channel_marshall_channels(MainChannel *main_chan) @@ -301,7 +301,7 @@ int main_channel_push_ping(Channel *channel, int size) return FALSE; } item = main_ping_item_new(main_chan, size); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); return TRUE; } @@ -331,7 +331,7 @@ void main_channel_push_mouse_mode(Channel *channel, int current_mode, item = main_mouse_mode_item_new(main_chan, current_mode, is_client_mouse_allowed); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static void main_channel_marshall_mouse_mode(MainChannel *main_chan, int current_mode, int is_client_mouse_allowed) @@ -352,7 +352,7 @@ void main_channel_push_agent_connected(Channel *channel) MainChannel *main_chan = channel->data; item = main_pipe_item_new(main_chan, SPICE_MSG_MAIN_AGENT_CONNECTED); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } void main_channel_push_agent_disconnected(Channel *channel) @@ -361,7 +361,7 @@ void main_channel_push_agent_disconnected(Channel *channel) MainChannel *main_chan = channel->data; item = main_pipe_item_new(main_chan, SPICE_MSG_MAIN_AGENT_DISCONNECTED); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static void main_channel_marshall_agent_disconnected(MainChannel *main_chan) @@ -378,7 +378,7 @@ void main_channel_push_tokens(Channel *channel, uint32_t num_tokens) MainChannel *main_chan = channel->data; TokensPipeItem *item = main_tokens_item_new(main_chan, num_tokens); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static void main_channel_marshall_tokens(MainChannel *main_chan, uint32_t num_tokens) @@ -397,7 +397,7 @@ void main_channel_push_agent_data(Channel *channel, uint8_t* data, size_t len, AgentDataPipeItem *item; item = main_agent_data_item_new(main_chan, data, len, free_data, opaque); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static void main_channel_marshall_agent_data(MainChannel *main_chan, @@ -411,7 +411,7 @@ static void main_channel_push_migrate_data_item(MainChannel *main_chan) { RedsOutItem *item = main_pipe_item_new(main_chan, SPICE_MSG_MIGRATE_DATA); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static void main_channel_marshall_migrate_data_item(MainChannel *main_chan) @@ -442,7 +442,7 @@ void main_channel_push_init(Channel *channel, int connection_id, item = main_init_item_new(main_chan, connection_id, display_channels_hint, current_mouse_mode, is_client_mouse_allowed, multi_media_time, ram_hint); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static void main_channel_marshall_init(MainChannel *main_chan, @@ -469,7 +469,7 @@ void main_channel_push_notify(Channel *channel, uint8_t *mess, const int mess_le MainChannel *main_chan = channel->data; NotifyPipeItem *item = main_notify_item_new(main_chan, mess, mess_len); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static void main_channel_marshall_notify(MainChannel *main_chan, NotifyPipeItem *item) @@ -494,7 +494,7 @@ void main_channel_push_migrate_begin(Channel *channel, int port, int sport, MigrateBeginPipeItem *item = main_migrate_begin_item_new(main_chan, port, sport, host, cert_pub_key_type, cert_pub_key_len, cert_pub_key); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static void main_channel_marshall_migrate_begin(MainChannel *main_chan, @@ -518,7 +518,7 @@ void main_channel_push_migrate(Channel *channel) MainChannel *main_chan = channel->data; RedsOutItem *item = main_pipe_item_new(main_chan, SPICE_MSG_MIGRATE); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static void main_channel_marshall_migrate(MainChannel *main_chan) @@ -535,7 +535,7 @@ void main_channel_push_migrate_cancel(Channel *channel) RedsOutItem *item = main_pipe_item_new(main_chan, SPICE_MSG_MAIN_MIGRATE_CANCEL); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } void main_channel_push_multi_media_time(Channel *channel, int time) @@ -544,7 +544,7 @@ void main_channel_push_multi_media_time(Channel *channel, int time) MultiMediaTimePipeItem *item = main_multi_media_time_item_new(main_chan, time); - red_channel_pipe_add(&main_chan->base, &item->base); + red_channel_pipe_add_push(&main_chan->base, &item->base); } static PipeItem *main_migrate_switch_item_new(MainChannel *main_chan) @@ -560,7 +560,7 @@ void main_channel_push_migrate_switch(Channel *channel) { MainChannel *main_chan = channel->data; - red_channel_pipe_add(&main_chan->base, + red_channel_pipe_add_push(&main_chan->base, main_migrate_switch_item_new(main_chan)); } diff --git a/server/red_channel.c b/server/red_channel.c index afa3ff2f..be66dfb3 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -507,7 +507,14 @@ void red_channel_pipe_add(RedChannel *channel, PipeItem *item) channel->pipe_size++; ring_add(&channel->pipe, &item->link); +} + +void red_channel_pipe_add_push(RedChannel *channel, PipeItem *item) +{ + ASSERT(channel); + channel->pipe_size++; + ring_add(&channel->pipe, &item->link); red_channel_push(channel); } diff --git a/server/red_channel.h b/server/red_channel.h index a778ffbe..1521f417 100644 --- a/server/red_channel.h +++ b/server/red_channel.h @@ -211,6 +211,7 @@ void red_channel_set_message_serial(RedChannel *channel, uint64_t); void red_channel_begin_send_message(RedChannel *channel); void red_channel_pipe_item_init(RedChannel *channel, PipeItem *item, int type); +void red_channel_pipe_add_push(RedChannel *channel, PipeItem *item); void red_channel_pipe_add(RedChannel *channel, PipeItem *item); int red_channel_pipe_item_is_linked(RedChannel *channel, PipeItem *item); void red_channel_pipe_item_remove(RedChannel *channel, PipeItem *item); diff --git a/server/smartcard.c b/server/smartcard.c index 93142cce..b22d7c44 100644 --- a/server/smartcard.c +++ b/server/smartcard.c @@ -353,9 +353,9 @@ static void smartcard_channel_disconnect(RedChannel *channel) /* this is called from both device input and client input. since the device is * a usb device, the context is still the main thread (kvm_main_loop, timers) * so no mutex is required. */ -static void smartcard_channel_pipe_add(SmartCardChannel *channel, PipeItem *item) +static void smartcard_channel_pipe_add_push(SmartCardChannel *channel, PipeItem *item) { - red_channel_pipe_add(&channel->base, item); + red_channel_pipe_add_push(&channel->base, item); } static void smartcard_push_error(SmartCardChannel* channel, reader_id_t reader_id, VSCErrorCode error) @@ -365,7 +365,7 @@ static void smartcard_push_error(SmartCardChannel* channel, reader_id_t reader_i error_item->base.type = PIPE_ITEM_TYPE_ERROR; error_item->reader_id = reader_id; error_item->error = error; - smartcard_channel_pipe_add(channel, &error_item->base); + smartcard_channel_pipe_add_push(channel, &error_item->base); } static void smartcard_push_reader_add_response(SmartCardChannel *channel, uint32_t reader_id) @@ -374,7 +374,7 @@ static void smartcard_push_reader_add_response(SmartCardChannel *channel, uint32 rar_item->base.type = PIPE_ITEM_TYPE_READER_ADD_RESPONSE; rar_item->reader_id = reader_id; - smartcard_channel_pipe_add(channel, &rar_item->base); + smartcard_channel_pipe_add_push(channel, &rar_item->base); } static void smartcard_push_vscmsg(SmartCardChannel *channel, VSCMsgHeader *vheader) @@ -383,7 +383,7 @@ static void smartcard_push_vscmsg(SmartCardChannel *channel, VSCMsgHeader *vhead msg_item->base.type = PIPE_ITEM_TYPE_MSG; msg_item->vheader = vheader; - smartcard_channel_pipe_add(channel, &msg_item->base); + smartcard_channel_pipe_add_push(channel, &msg_item->base); } void smartcard_on_message_from_device(SmartCardChannel *smartcard_channel, |