[Spice-devel] [PATCH phodav 2/2] spice: handle client disconnect gracefully

Jakub Janků jjanku at redhat.com
Mon Jul 22 13:22:11 UTC 2019


If the client (spice-gtk) disconnects e.g. during a file transfer,
the mux stream gets closed and the count of read bytes does not
match the count that the client previously announced.
However, in this case, we mustn't simply return, since that would
prevent any further connections.

Signed-off-by: Jakub Janků <jjanku at redhat.com>
---
 spice/spice-webdavd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
index 81b4d91..e1e0f5c 100644
--- a/spice/spice-webdavd.c
+++ b/spice/spice-webdavd.c
@@ -251,11 +251,13 @@ mux_data_read_cb (GObject      *source_object,
   gssize size;
 
   size = input_stream_read_thread_finish (G_INPUT_STREAM (source_object), res, &error);
-  g_return_if_fail (size == demux.size);
   if (error)
     {
       g_warning ("error: %s", error->message);
       g_clear_error (&error);
+    }
+  if (size != demux.size)
+    {
       quit (-1);
       return;
     }
-- 
2.21.0



More information about the Spice-devel mailing list