[PATCH spice-server 13/13] red-channel-client: Add some comment on the flush code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/red-channel-client.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 3fd51d78b..337733d5d 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -1319,6 +1319,9 @@ void red_channel_client_push(RedChannelClient *rcc)
     /* prepare_pipe_add() will reenable WRITE events when the rcc->priv->pipe is empty
      * red_channel_client_ack_zero_messages_window() will reenable WRITE events
      * if we were waiting for acks to be received
+     * If we don't remove WRITE if we are waiting for ack we will be keep
+     * notified that we can write and we then exit (see pipe_item_get) as we
+     * are waiting for the ack consuming CPU in a tight loop
      */
     if ((red_channel_client_no_item_being_sent(rcc) && g_queue_is_empty(&rcc->priv->pipe)) ||
         red_channel_client_waiting_for_ack(rcc)) {
@@ -1326,6 +1329,9 @@ void red_channel_client_push(RedChannelClient *rcc)
         /* channel has no pending data to send so now we can flush data in
          * order to avoid data stall into buffers in case of manual
          * flushing
+         * We need to flush also in case of ack as it is possible
+         * that for a long train of small messages the message that would
+         * cause the client to send the ack is still in the queue
          */
         red_stream_flush(rcc->priv->stream);
     }
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]