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

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