[Spice-devel] [RFC v4 28/62] server/red_channel: add two helper functions

Alon Levy alevy at redhat.com
Tue Apr 26 03:54:53 PDT 2011


---
 server/red_channel.c |   10 ++++++++++
 server/red_channel.h |    3 +++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/server/red_channel.c b/server/red_channel.c
index c6e23d9..b2d0cdb 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -925,6 +925,11 @@ int red_channel_any_blocked(RedChannel *channel)
     return !channel || !channel->rcc || channel->rcc->send_data.blocked;
 }
 
+int red_channel_client_blocked(RedChannelClient *rcc)
+{
+    return rcc && rcc->send_data.blocked;
+}
+
 int red_channel_client_send_message_pending(RedChannelClient *rcc)
 {
     return rcc->send_data.header->type != 0;
@@ -975,6 +980,11 @@ int red_channel_no_item_being_sent(RedChannel *channel)
     return !channel->rcc || channel->rcc->send_data.item == NULL;
 }
 
+int red_channel_client_no_item_being_sent(RedChannelClient *rcc)
+{
+    return !rcc || rcc->send_data.item == NULL;
+}
+
 void red_channel_client_pipe_remove_and_release(RedChannelClient *rcc,
                                                 PipeItem *item)
 {
diff --git a/server/red_channel.h b/server/red_channel.h
index 99b273a..44a40f0 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -311,6 +311,8 @@ int red_channel_all_blocked(RedChannel *channel);
 /* return TRUE if any of the connected clients to this channel are blocked */
 int red_channel_any_blocked(RedChannel *channel);
 
+int red_channel_client_blocked(RedChannelClient *rcc);
+
 /* helper for channels that have complex logic that can possibly ready a send */
 int red_channel_client_send_message_pending(RedChannelClient *rcc);
 
@@ -322,6 +324,7 @@ int red_channel_item_being_sent(RedChannel *channel, PipeItem *item);
 int red_channel_client_item_being_sent(RedChannelClient *rcc, PipeItem *item);
 
 int red_channel_no_item_being_sent(RedChannel *channel);
+int red_channel_client_no_item_being_sent(RedChannelClient *rcc);
 
 void red_channel_pipes_remove(RedChannel *channel, PipeItem *item);
 
-- 
1.7.4.4



More information about the Spice-devel mailing list