[Spice-devel] [PATCH 03/23] server/red_worker: add send_item
Alon Levy
alevy at redhat.com
Fri Feb 11 09:22:51 PST 2011
---
server/red_worker.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/server/red_worker.c b/server/red_worker.c
index 41223a8..b1eaee2 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -350,6 +350,7 @@ typedef struct LocalCursor {
typedef struct RedChannel RedChannel;
typedef void (*channel_disconnect_proc)(RedChannel *channel);
typedef void (*channel_hold_pipe_item_proc)(RedChannel *channel, PipeItem *item);
+typedef void (*channel_send_pipe_item_proc)(RedChannel *channel, PipeItem *item);
typedef void (*channel_release_pipe_item_proc)(RedChannel *channel, PipeItem *item, int item_pushed);
typedef int (*channel_handle_parsed_proc)(RedChannel *channel, uint32_t size, uint16_t type, void *message);
@@ -389,6 +390,9 @@ struct RedChannel {
channel_hold_pipe_item_proc hold_item;
channel_release_pipe_item_proc release_item;
channel_handle_parsed_proc handle_parsed;
+ channel_send_pipe_item_proc send_item;
+
+ int during_send;
#ifdef RED_STATISTICS
struct {
@@ -8411,9 +8415,9 @@ static void display_channel_push(RedWorker *worker)
}
}
-static void cursor_channel_send_item(CursorChannel *cursor_channel, PipeItem *pipe_item)
+static void cursor_channel_send_item(RedChannel *channel, PipeItem *pipe_item)
{
- RedChannel *channel = &cursor_channel->common.base;
+ CursorChannel *cursor_channel = SPICE_CONTAINEROF(channel, CursorChannel, common.base);
red_ref_channel(channel);
red_channel_reset_send_data(channel);
@@ -8462,7 +8466,7 @@ static void cursor_channel_push(RedWorker *worker)
PipeItem *pipe_item;
while ((pipe_item = red_channel_pipe_get((RedChannel *)worker->cursor_channel))) {
- cursor_channel_send_item(worker->cursor_channel, pipe_item);
+ cursor_channel_send_item(&worker->cursor_channel->common.base, pipe_item);
}
}
@@ -9355,6 +9359,7 @@ static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_i
RedsStreamContext *peer, int migrate,
event_listener_action_proc handler,
channel_disconnect_proc disconnect,
+ channel_send_pipe_item_proc send_item,
channel_hold_pipe_item_proc hold_item,
channel_release_pipe_item_proc release_item,
channel_handle_parsed_proc handle_parsed)
@@ -9390,6 +9395,7 @@ static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_i
common->listener.action = handler;
common->listener.free = free_common_channel_from_listener;
channel->disconnect = disconnect;
+ channel->send_item = send_item;
channel->hold_item = hold_item;
channel->release_item = release_item;
channel->handle_parsed = handle_parsed;
@@ -9496,6 +9502,7 @@ static void handle_new_display_channel(RedWorker *worker, RedsStreamContext *pee
SPICE_CHANNEL_DISPLAY, peer,
migrate, handle_channel_events,
red_disconnect_display,
+ display_channel_send_item,
display_channel_hold_pipe_item,
display_channel_release_item,
display_channel_handle_message))) {
@@ -9622,6 +9629,7 @@ static void red_connect_cursor(RedWorker *worker, RedsStreamContext *peer, int m
SPICE_CHANNEL_CURSOR, peer, migrate,
handle_channel_events,
red_disconnect_cursor,
+ cursor_channel_send_item,
cursor_channel_hold_pipe_item,
cursor_channel_release_item,
channel_handle_message))) {
--
1.7.4
More information about the Spice-devel
mailing list