[spice-gtk PATCH v1 3/3] webdav: write all buffer to client webdav

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

 



Client's webdav can request less data (8192) then the amount sent by
guest's webdav. Using g_output_stream_write_all_async in order to avoid
losing data.
---
 gtk/channel-webdav.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gtk/channel-webdav.c b/gtk/channel-webdav.c
index 9e3a824..290f935 100644
--- a/gtk/channel-webdav.c
+++ b/gtk/channel-webdav.c
@@ -315,9 +315,9 @@ static void demux_to_client_cb(GObject *source, GAsyncResult *result, gpointer u
     SpiceWebdavChannelPrivate *c = client->self->priv;
     GError *error = NULL;
     gboolean fail;
-    gssize size;
+    gsize size;
 
-    size = g_output_stream_write_finish(G_OUTPUT_STREAM(source), result, &error);
+    g_output_stream_write_all_finish(G_OUTPUT_STREAM(source), result, &size, &error);
 
     if (error) {
         CHANNEL_DEBUG(client->self, "write failed: %s", error->message);
@@ -332,14 +332,14 @@ static void demux_to_client_cb(GObject *source, GAsyncResult *result, gpointer u
 static void demux_to_client(Client *client)
 {
     SpiceWebdavChannelPrivate *c = client->self->priv;
-    gssize size = c->demux.size;
+    gsize size = c->demux.size;
 
-    CHANNEL_DEBUG(client->self, "pushing %"G_GSSIZE_FORMAT" to client %p", size, client);
+    CHANNEL_DEBUG(client->self, "pushing %"G_GSIZE_FORMAT" to client %p", size, client);
 
     if (size > 0) {
-        g_output_stream_write_async(g_io_stream_get_output_stream(client->pipe),
-                                    c->demux.buf, size, G_PRIORITY_DEFAULT,
-                                    c->cancellable, demux_to_client_cb, client);
+        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);
     } else {
         /* Nothing to write */
         demux_to_client_finish(client, FALSE);
-- 
2.4.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]