[Spice-devel] [spice-gtk PATCH v1 3/3] webdav: write all buffer to client webdav
Victor Toso
victortoso at redhat.com
Mon May 18 00:09:58 PDT 2015
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
More information about the Spice-devel
mailing list