diff options
author | Alon Levy <alevy@redhat.com> | 2010-11-07 19:24:41 +0200 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-02-11 15:32:21 +0200 |
commit | d7521edac125cee5c95c7a1e27bf1866bdb2519d (patch) | |
tree | fb537230d90f650bc936bbe7e605546bca593f0c | |
parent | f8d3345ef71ffb429c68d7bbd863204264ef3c8d (diff) | |
download | spice-d7521edac125cee5c95c7a1e27bf1866bdb2519d.tar.gz spice-d7521edac125cee5c95c7a1e27bf1866bdb2519d.tar.xz spice-d7521edac125cee5c95c7a1e27bf1866bdb2519d.zip |
server/red_worker: renames to add channel_ prefix and consistent sig
s/disconnect_channel_proc/channel_disconnect_proc/
s/release_item_proc/channel_release_pipe_item_proc/
s/handle_message_proc/channel_handle_parsed_proc/
Adds RedChannel* channel as first parameter to hold_pipe_item_proc
-rw-r--r-- | server/red_worker.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/server/red_worker.c b/server/red_worker.c index 1574b993..2cf3031a 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -348,10 +348,10 @@ typedef struct LocalCursor { #define PALETTE_CACHE_HASH_KEY(id) ((id) & PALETTE_CACHE_HASH_MASK) typedef struct RedChannel RedChannel; -typedef void (*disconnect_channel_proc)(RedChannel *channel); -typedef void (*hold_pipe_item_proc)(PipeItem *item); -typedef void (*release_item_proc)(RedChannel *channel, void *item); -typedef int (*handle_message_proc)(RedChannel *channel, size_t size, uint32_t type, void *message); +typedef void (*channel_disconnect_proc)(RedChannel *channel); +typedef void (*channel_hold_pipe_item_proc)(RedChannel *channel, PipeItem *item); +typedef void (*channel_release_pipe_item_proc)(RedChannel *channel, void *item); +typedef int (*channel_handle_parsed_proc)(RedChannel *channel, uint32_t size, uint16_t type, void *message); struct RedChannel { spice_parse_channel_func_t parser; @@ -385,10 +385,11 @@ struct RedChannel { uint8_t *end; } recive_data; - disconnect_channel_proc disconnect; - hold_pipe_item_proc hold_item; - release_item_proc release_item; - handle_message_proc handle_message; + channel_disconnect_proc disconnect; + channel_hold_pipe_item_proc hold_item; + channel_release_pipe_item_proc release_item; + channel_handle_parsed_proc handle_parsed; + #ifdef RED_STATISTICS uint64_t *out_bytes_counter; #endif @@ -1179,7 +1180,7 @@ static void show_draw_item(RedWorker *worker, DrawItem *draw_item, const char *p static void red_channel_init_send_data(RedChannel *channel, uint16_t type, PipeItem *item) { if (item) { - channel->hold_item(item); + channel->hold_item(channel, item); ASSERT(channel->send_data.item == NULL); channel->send_data.item = item; } @@ -8940,7 +8941,7 @@ static void on_new_display_channel(RedWorker *worker) } } -static int channel_handle_message(RedChannel *channel, size_t size, uint32_t type, void *message) +static int channel_handle_message(RedChannel *channel, uint32_t size, uint16_t type, void *message) { switch (type) { case SPICE_MSGC_ACK_SYNC: @@ -9247,7 +9248,7 @@ static int display_channel_handle_migrate_data(DisplayChannel *channel, size_t s return TRUE; } -static int display_channel_handle_message(RedChannel *channel, size_t size, uint32_t type, void *message) +static int display_channel_handle_message(RedChannel *channel, uint32_t size, uint16_t type, void *message) { switch (type) { case SPICE_MSGC_DISPLAY_INIT: @@ -9315,7 +9316,7 @@ static void red_receive(RedChannel *channel) return; } - if (!channel->handle_message(channel, parsed_size, header->type, parsed)) { + if (!channel->handle_parsed(channel, parsed_size, header->type, parsed)) { free(parsed); channel->disconnect(channel); return; @@ -9348,10 +9349,10 @@ static void free_common_channel_from_listener(EventListener *ctx) static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_id, RedsStreamContext *peer, int migrate, event_listener_action_proc handler, - disconnect_channel_proc disconnect, - hold_pipe_item_proc hold_item, - release_item_proc release_item, - handle_message_proc handle_message) + channel_disconnect_proc disconnect, + channel_hold_pipe_item_proc hold_item, + channel_release_pipe_item_proc release_item, + channel_handle_parsed_proc handle_parsed) { struct epoll_event event; RedChannel *channel; @@ -9386,7 +9387,7 @@ static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_i channel->disconnect = disconnect; channel->hold_item = hold_item; channel->release_item = release_item; - channel->handle_message = handle_message; + channel->handle_parsed = handle_parsed; channel->peer = peer; common->worker = worker; channel->ack_data.messages_window = ~0; // blocks send message (maybe use send_data.blocked + @@ -9433,7 +9434,7 @@ static void handle_channel_events(EventListener *in_listener, uint32_t events) } } -static void display_channel_hold_pipe_item(PipeItem *item) +static void display_channel_hold_pipe_item(RedChannel *channel, PipeItem *item) { ASSERT(item); switch (item->type) { @@ -9592,7 +9593,7 @@ static void on_new_cursor_channel(RedWorker *worker) } } -static void cursor_channel_hold_pipe_item(PipeItem *item) +static void cursor_channel_hold_pipe_item(RedChannel *channel, PipeItem *item) { ASSERT(item); ((CursorItem *)item)->refs++; @@ -9725,7 +9726,7 @@ static void red_wait_pipe_item_sent(RedChannel *channel, PipeItem *item) red_printf(""); common = SPICE_CONTAINEROF(channel, CommonChannel, base); red_ref_channel(channel); - channel->hold_item(item); + channel->hold_item(channel, item); end_time = red_now() + CHANNEL_PUSH_TIMEOUT; |