[Spice-devel] [PATCH spice-gtk v2 4/5] webdav: remove client on empty message
Jakub Janků
jjanku at redhat.com
Wed Jun 19 15:37:49 UTC 2019
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 at redhat.com>
---
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
More information about the Spice-devel
mailing list