[Spice-commits] 4 commits - src/channel-webdav.c src/vmcstream.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 19 15:48:56 UTC 2019


 src/channel-webdav.c |   32 +++++++++++++++++++++-----------
 src/vmcstream.c      |    5 +++++
 2 files changed, 26 insertions(+), 11 deletions(-)

New commits:
commit 78aaecfa61491ea95be00888281c76af2063168e
Author: Jakub Janků <jjanku at redhat.com>
Date:   Wed Jun 19 17:37:50 2019 +0200

    webdav: don't warn on cancel
    
    The IO operation is cancelled on channel dispose
    and it is not an error, so silence the warnings.
    
    Signed-off-by: Jakub Janků <jjanku at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index a8cdcbc..f5a38ad 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -409,7 +409,9 @@ static void data_read_cb(GObject *source_object,
 
     size = spice_vmc_input_stream_read_all_finish(G_INPUT_STREAM(source_object), res, &error);
     if (error) {
-        g_warning("error: %s", error->message);
+        if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+            g_warning("error: %s", error->message);
+        }
         g_clear_error(&error);
         return;
     }
@@ -453,7 +455,9 @@ static void size_read_cb(GObject *source_object,
 
 end:
     if (error) {
-        g_warning("error: %s", error->message);
+        if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+            g_warning("error: %s", error->message);
+        }
         g_clear_error(&error);
     }
 }
@@ -480,7 +484,9 @@ static void client_read_cb(GObject *source_object,
 
 end:
     if (error) {
-        g_warning("error: %s", error->message);
+        if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+            g_warning("error: %s", error->message);
+        }
         g_clear_error(&error);
     }
 }
commit a7850b432ad53c8a697aac84a7a10c243576f517
Author: Jakub Janků <jjanku at redhat.com>
Date:   Wed Jun 19 17:37:49 2019 +0200

    webdav: remove client on empty message
    
    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>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

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
 }
 
commit ec033beff04d759a9cac361787a60b3a20174122
Author: Jakub Janků <jjanku at redhat.com>
Date:   Wed Jun 19 17:37:48 2019 +0200

    webdav: don't start client on empty message
    
    If the client on the remote side disconnects,
    spice-webdav daemon sends a message with no data.
    
    However, if the phodav server already closed
    the client connection, client lookup fails and
    we open a new connection to phodav, but don't write
    anything to it - this should not happen,
    so in such case, ignore the message and start
    demuxing again.
    
    Signed-off-by: Jakub Janků <jjanku at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index 822fee0..4e08efa 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -421,8 +421,12 @@ static void data_read_cb(GObject *source_object,
 
     if (client)
         demux_to_client(client);
-    else
+    else if (size > 0) {
         start_client(self);
+    } else {
+        c->demuxing = FALSE;
+        start_demux(self);
+    }
 }
 
 
commit 7862d9e79aa5e5dc8141c5f70782ea8ec81d5f27
Author: Jakub Janků <jjanku at redhat.com>
Date:   Wed Jun 19 17:37:47 2019 +0200

    vmcstream: finish task immediately when reading 0 bytes
    
    The current implementation finishes it only after new data
    arrives from the channel (or after it is cancelled).
    
    Signed-off-by: Jakub Janků <jjanku at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/vmcstream.c b/src/vmcstream.c
index 86c949a..b6f6d1a 100644
--- a/src/vmcstream.c
+++ b/src/vmcstream.c
@@ -209,6 +209,11 @@ spice_vmc_input_stream_read_all_async(GInputStream        *stream,
                       cancellable,
                       callback,
                       user_data);
+    if (count == 0) {
+        g_task_return_int(task, 0);
+        g_object_unref(task);
+        return;
+    }
     self->task = task;
     if (cancellable)
         self->cancel_id =


More information about the Spice-commits mailing list