[PATCH spice-gtk v2 4/5] webdav: remove client on empty message

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

 



Message with no data from spice-webdav daemon means
the client disconnected.

In this case, the client connection to phodav
should be closed as well.

This can happen e.g. when file transfer gets cancelled.

Also, while we're at it, reorder the code a bit.

Signed-off-by: Jakub Janků <jjanku@xxxxxxxxxx>
---
 src/channel-webdav.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index 4e08efa..a8cdcbc 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -335,15 +335,15 @@ static void demux_to_client(Client *client)
 
     CHANNEL_DEBUG(client->self, "pushing %"G_GSIZE_FORMAT" to client %p", size, client);
 
-    if (size > 0) {
-        g_output_stream_write_all_async(g_io_stream_get_output_stream(client->pipe),
-                                        c->demux.buf, size, G_PRIORITY_DEFAULT,
-                                        c->cancellable, demux_to_client_cb, client);
+    if (size == 0) {
+        /* Client disconnected */
+        demux_to_client_finish(client, TRUE);
         return;
-    } else {
-        /* Nothing to write */
-        demux_to_client_finish(client, FALSE);
     }
+
+    g_output_stream_write_all_async(g_io_stream_get_output_stream(client->pipe),
+                                    c->demux.buf, size, G_PRIORITY_DEFAULT,
+                                    c->cancellable, demux_to_client_cb, client);
 #endif
 }
 
-- 
2.21.0

_______________________________________________
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]