From 2fcd35b073a20bfb67ab6fd14234ec7571220ec7 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Tue, 9 Nov 2010 11:45:57 +0200 Subject: [PATCH] server/red_channel: add more ack api --- server/red_channel.c | 10 ++++++++++ server/red_channel.h | 3 +++ server/red_worker.c | 12 +++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/server/red_channel.c b/server/red_channel.c index 4492cfb5..17db700a 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -635,3 +635,13 @@ void red_channel_pipe_clear(RedChannel *channel) channel->pipe_size = 0; } +void red_channel_ack_zero_messages_window(RedChannel *channel) +{ + channel->ack_data.messages_window = 0; +} + +void red_channel_ack_set_client_window(RedChannel *channel, int client_window) +{ + channel->ack_data.client_window = client_window; +} + diff --git a/server/red_channel.h b/server/red_channel.h index 9563c0e2..2d90de16 100644 --- a/server/red_channel.h +++ b/server/red_channel.h @@ -224,6 +224,9 @@ void red_channel_pipe_add_tail(RedChannel *channel, PipeItem *item); /* for types that use this routine -> the pipe item should be freed */ void red_channel_pipe_add_type(RedChannel *channel, int pipe_item_type); +void red_channel_ack_zero_messages_window(RedChannel *channel); +void red_channel_ack_set_client_window(RedChannel *channel, int client_window); + // TODO: unstaticed for display/cursor channels. they do some specific pushes not through // adding elements or on events. but not sure if this is actually required (only result // should be that they ""try"" a little harder, but if the event system is correct it diff --git a/server/red_worker.c b/server/red_worker.c index adf73a14..0bb624fd 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -8682,7 +8682,7 @@ static void on_new_display_channel(RedWorker *worker) if (!display_channel_wait_for_init(display_channel)) { return; } - display_channel->common.base.ack_data.messages_window = 0; + red_channel_ack_zero_messages_window(&display_channel->common.base); if (worker->surfaces[0].context.canvas) { red_current_flush(worker, 0); push_new_primary_surface(worker); @@ -8976,8 +8976,7 @@ static int display_channel_handle_migrate_data(DisplayChannel *channel, size_t s } red_channel_pipe_add_type((RedChannel *)channel, PIPE_ITEM_TYPE_INVAL_PALLET_CACHE); - - channel->common.base.ack_data.messages_window = 0; + red_channel_ack_zero_messages_window(&channel->common.base); return TRUE; } @@ -9085,8 +9084,8 @@ static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_i common->worker = worker; // TODO: Should this be distinctive for the Display/Cursor channels? doesn't // make sense, does it? - channel->ack_data.client_window = IS_LOW_BANDWIDTH() ? WIDE_CLIENT_ACK_WINDOW : - NARROW_CLIENT_ACK_WINDOW; + red_channel_ack_set_client_window(channel, + IS_LOW_BANDWIDTH() ? WIDE_CLIENT_ACK_WINDOW : NARROW_CLIENT_ACK_WINDOW); event.events = EPOLLIN | EPOLLOUT | EPOLLET; event.data.ptr = &common->listener; @@ -9272,8 +9271,7 @@ static void on_new_cursor_channel(RedWorker *worker) CursorChannel *channel = worker->cursor_channel; ASSERT(channel); - - channel->common.base.ack_data.messages_window = 0; + red_channel_ack_zero_messages_window(&channel->common.base); red_channel_pipe_add_type(&channel->common.base, PIPE_ITEM_TYPE_SET_ACK); if (worker->surfaces[0].context.canvas && !channel->common.base.migrate) { red_channel_pipe_add_type(&worker->cursor_channel->common.base, PIPE_ITEM_TYPE_CURSOR_INIT);