summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-11-11 19:15:45 +0200
committerAlon Levy <alevy@redhat.com>2011-03-02 17:27:53 +0200
commit5575d6e5fac35e92ccc563c82e6cd98031388081 (patch)
tree8c50981b61a087316c8e8c73afa6a80c9cce58ae /server
parent17ebd6a71946b456345b2f997861a55535e9c39d (diff)
downloadspice-5575d6e5fac35e92ccc563c82e6cd98031388081.tar.gz
spice-5575d6e5fac35e92ccc563c82e6cd98031388081.tar.xz
spice-5575d6e5fac35e92ccc563c82e6cd98031388081.zip
server/red_channel: add red_channel_{,no_}item_being_sent
Diffstat (limited to 'server')
-rw-r--r--server/red_channel.c15
-rw-r--r--server/red_channel.h8
-rw-r--r--server/red_worker.c10
3 files changed, 26 insertions, 7 deletions
diff --git a/server/red_channel.c b/server/red_channel.c
index f2665a46..8eb4e0d8 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -727,6 +727,12 @@ RedsStream *red_channel_get_stream(RedChannel *channel)
return channel->stream;
}
+SpiceDataHeader *red_channel_get_header(RedChannel *channel)
+{
+ return channel->send_data.header;
+}
+/* end of accessors */
+
int red_channel_get_first_socket(RedChannel *channel)
{
if (!channel->stream) {
@@ -735,7 +741,12 @@ int red_channel_get_first_socket(RedChannel *channel)
return channel->stream->socket;
}
-SpiceDataHeader *red_channel_get_header(RedChannel *channel)
+int red_channel_item_being_sent(RedChannel *channel, PipeItem *item)
{
- return channel->send_data.header;
+ return channel->send_data.item == item;
+}
+
+int red_channel_no_item_being_sent(RedChannel *channel)
+{
+ return channel->send_data.item == NULL;
}
diff --git a/server/red_channel.h b/server/red_channel.h
index ce8ef20a..d08b661a 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -260,6 +260,14 @@ int red_channel_any_blocked(RedChannel *channel);
/* helper for channels that have complex logic that can possibly ready a send */
int red_channel_send_message_pending(RedChannel *channel);
+/* returns TRUE if item is being sent by one of the channel clients. This will
+ * be true if someone called init_send_data but send has not completed (or perhaps
+ * hasn't even begun, i.e. no one called begin_send_)
+ * */
+int red_channel_item_being_sent(RedChannel *channel, PipeItem *item);
+
+int red_channel_no_item_being_sent(RedChannel *channel);
+
// 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 357ddee9..b5bb3b3b 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -9436,7 +9436,7 @@ static void red_wait_pipe_item_sent(RedChannel *channel, PipeItem *item)
red_printf("timeout");
channel->disconnect(channel);
} else {
- if (channel->send_data.item == item) {
+ if (red_channel_item_being_sent(channel, item)) {
red_wait_outgoing_item(channel);
}
}
@@ -9522,7 +9522,7 @@ static inline void destroy_surface_wait(RedWorker *worker, int surface_id)
// there is one during sending.
red_wait_outgoing_item((RedChannel *)worker->display_channel);
if (worker->display_channel) {
- ASSERT(!worker->display_channel->common.base.send_data.item);
+ ASSERT(red_channel_no_item_being_sent(&worker->display_channel->common.base));
}
}
@@ -9570,7 +9570,7 @@ static inline void handle_dev_destroy_surfaces(RedWorker *worker)
if (!worker->cursor_channel->common.base.migrate) {
red_pipe_add_verb(&worker->cursor_channel->common.base, SPICE_MSG_CURSOR_RESET);
}
- ASSERT(!worker->cursor_channel->common.base.send_data.item);
+ ASSERT(red_channel_no_item_being_sent(&worker->cursor_channel->common.base));
}
if (worker->display_channel) {
@@ -9646,7 +9646,7 @@ static inline void handle_dev_destroy_primary_surface(RedWorker *worker)
if (!worker->cursor_channel->common.base.migrate) {
red_pipe_add_verb(&worker->cursor_channel->common.base, SPICE_MSG_CURSOR_RESET);
}
- ASSERT(!worker->cursor_channel->common.base.send_data.item);
+ ASSERT(red_channel_no_item_being_sent(&worker->cursor_channel->common.base));
}
flush_all_qxl_commands(worker);
@@ -9708,7 +9708,7 @@ static void handle_dev_input(EventListener *listener, uint32_t events)
if (!cursor_red_channel->migrate) {
red_pipe_add_verb(cursor_red_channel, SPICE_MSG_CURSOR_RESET);
}
- ASSERT(!cursor_red_channel->send_data.item);
+ ASSERT(red_channel_no_item_being_sent(cursor_red_channel));
worker->cursor_visible = TRUE;
worker->cursor_position.x = worker->cursor_position.y = 0;