server/red_channel: add more ack api

This commit is contained in:
Alon Levy 2010-11-09 11:45:57 +02:00
parent 766bb420bb
commit 2fcd35b073
3 changed files with 18 additions and 7 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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);