[Spice-devel] [PATCH 19/23] server/red_channel: add red_channel_waiting_for_ack

Alon Levy alevy at redhat.com
Mon Feb 7 09:31:21 PST 2011


small inline function to have the ack window logic.
---
 server/red_channel.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/server/red_channel.c b/server/red_channel.c
index 93338b6..04fc643 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -572,17 +572,20 @@ void red_channel_pipe_add_type(RedChannel *channel, int pipe_item_type)
     red_channel_push(channel);
 }
 
-static PipeItem *red_channel_pipe_get(RedChannel *channel)
+static inline int red_channel_waiting_for_ack(RedChannel *channel)
+{
+    return (channel->handle_acks && (channel->ack_data.messages_window > channel->ack_data.client_window * 2));
+}
+
+static inline PipeItem *red_channel_pipe_get(RedChannel *channel)
 {
     PipeItem *item;
 
     if (!channel || channel->send_data.blocked ||
-        (channel->handle_acks &&
-         (channel->ack_data.messages_window > channel->ack_data.client_window * 2)) ||
+        red_channel_waiting_for_ack(channel) ||
         !(item = (PipeItem *)ring_get_tail(&channel->pipe))) {
         return NULL;
     }
-
     --channel->pipe_size;
     ring_remove(&item->link);
     return item;
-- 
1.7.4



More information about the Spice-devel mailing list