Blame SOURCES/0004-spice-channel-Read-all-available-data-from-SASL-buff.patch

7b23b6
From 1562755fd60ae79d595dd8be0d1ddf5b784729c2 Mon Sep 17 00:00:00 2001
7b23b6
From: Gilmar Santos Jr <jgasjr@gmail.com>
7b23b6
Date: Wed, 6 May 2020 12:58:51 -0300
7b23b6
Subject: [PATCH 4/9] spice-channel:  Read all available data from SASL buffer
7b23b6
7b23b6
When SASL is in use, its buffer may contain remaining data from previously
7b23b6
received messages. The spice_channel_iterate_read should use it, even if c->in
7b23b6
socket is not readable.
7b23b6
7b23b6
Fixes: https://gitlab.freedesktop.org/spice/spice-gtk/-/issues/126
7b23b6
7b23b6
Acked-by: Frediano Ziglio <fziglio@redhat.com>
7b23b6
(cherry picked from commit 80e9c852a406d93cad3fc7b845fe181d75356f11)
7b23b6
---
7b23b6
 src/spice-channel.c | 13 ++++++-------
7b23b6
 1 file changed, 6 insertions(+), 7 deletions(-)
7b23b6
7b23b6
diff --git a/src/spice-channel.c b/src/spice-channel.c
7b23b6
index 315e287..5824fdd 100644
7b23b6
--- a/src/spice-channel.c
7b23b6
+++ b/src/spice-channel.c
7b23b6
@@ -2345,16 +2345,15 @@ static void spice_channel_iterate_read(SpiceChannel *channel)
7b23b6
     /* treat all incoming data (block on message completion) */
7b23b6
     while (!c->has_error &&
7b23b6
            c->state != SPICE_CHANNEL_STATE_MIGRATING &&
7b23b6
-           g_pollable_input_stream_is_readable(G_POLLABLE_INPUT_STREAM(c->in))
7b23b6
-    ) { do
7b23b6
-            spice_channel_recv_msg(channel,
7b23b6
-                                   (handler_msg_in)SPICE_CHANNEL_GET_CLASS(channel)->handle_msg, NULL);
7b23b6
+           (g_pollable_input_stream_is_readable(G_POLLABLE_INPUT_STREAM(c->in))
7b23b6
 #ifdef HAVE_SASL
7b23b6
             /* flush the sasl buffer too */
7b23b6
-        while (c->sasl_decoded != NULL);
7b23b6
-#else
7b23b6
-        while (FALSE);
7b23b6
+           || c->sasl_decoded != NULL
7b23b6
 #endif
7b23b6
+           )
7b23b6
+    ) {
7b23b6
+        spice_channel_recv_msg(channel,
7b23b6
+                               (handler_msg_in)SPICE_CHANNEL_GET_CLASS(channel)->handle_msg, NULL);
7b23b6
     }
7b23b6
 
7b23b6
 }
7b23b6
-- 
7b23b6
2.26.2
7b23b6