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

Victor Toso de Carvalho victortoso at kemper.freedesktop.org
Mon Mar 27 14:55:07 UTC 2017


 src/channel-webdav.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit aae07fb3f7c9b5f37de3f6e97a943c2a490f682e
Author: Victor Toso <me at victortoso.com>
Date:   Thu Mar 23 15:26:12 2017 +0100

    channel-webdav: include comment about message handling
    
    Channel-webdav does not handle any other message besides
    SPICE_MSG_SPICEVMC_DATA it wants to let SpiceVmcInputStream handle it
    and the same to deal when sending data to the server with
    SPICE_MSGC_SPICEVMC_DATA using SpiceVmcOutputStream.
    
    The other Spice messages are dealt in its parent class channel-port
    and handled in channel-webdav handling port-event signal.
    
    This patch also renames webdav_handle_msg -> webdav_handle_data_msg
    for the reason described above.
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index 8baf9ca..4a246b5 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -584,7 +584,7 @@ static void spice_webdav_channel_class_init(SpiceWebdavChannelClass *klass)
 }
 
 /* coroutine context */
-static void webdav_handle_msg(SpiceChannel *channel, SpiceMsgIn *in)
+static void webdav_handle_data_msg(SpiceChannel *channel, SpiceMsgIn *in)
 {
     SpiceWebdavChannel *self = SPICE_WEBDAV_CHANNEL(channel);
     SpiceWebdavChannelPrivate *c = self->priv;
@@ -609,9 +609,13 @@ static void spice_webdav_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg)
     parent_class = SPICE_CHANNEL_CLASS(spice_webdav_channel_parent_class);
 
     if (type == SPICE_MSG_SPICEVMC_DATA)
-        webdav_handle_msg(channel, msg);
-    else if (parent_class->handle_msg)
-        parent_class->handle_msg(channel, msg);
-    else
-        g_return_if_reached();
+        webdav_handle_data_msg(channel, msg);
+
+    /* The only message that we need to handle ourselves is SPICE_MSG_SPICEVMC_DATA
+     * as we want to read it with spice_vmc_input/output_stream to handle
+     * channel-webdav inner protocol easily ($client, $data_size, $data).
+     * Everything else is handled by port-event signal from channel-port.c so we
+     * let it read the message for us. */
+    g_return_if_fail(parent_class->handle_msg != NULL);
+    parent_class->handle_msg(channel, msg);
 }


More information about the Spice-commits mailing list