[Spice-commits] server/common-graphics-channel.c server/common-graphics-channel.h server/dcc.c server/dcc.h server/display-channel.c server/red-channel-client.c server/red-channel-client.h server/red-channel.c server/red-channel.h server/sound.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Mar 8 16:57:30 UTC 2017


 server/common-graphics-channel.c |    6 ++----
 server/common-graphics-channel.h |    2 +-
 server/dcc.c                     |    8 ++++++--
 server/dcc.h                     |    1 -
 server/display-channel.c         |    1 -
 server/red-channel-client.c      |   14 +++++++++++++-
 server/red-channel-client.h      |    2 ++
 server/red-channel.c             |   11 -----------
 server/red-channel.h             |    2 --
 server/sound.c                   |    4 ++--
 10 files changed, 26 insertions(+), 25 deletions(-)

New commits:
commit 4f7fbb311367bf632250052a09479384806db488
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Mar 8 11:20:35 2017 +0000

    red-channel: Move config_socket vfunc to RedChannelClient
    
    config_socket is configuring the client stream socket.
    As is responsibility of RedChannelClient to handle the stream
    it make more sense to have the function in this object.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c
index 394a68e..eedd36f 100644
--- a/server/common-graphics-channel.c
+++ b/server/common-graphics-channel.c
@@ -120,7 +120,7 @@ common_graphics_channel_set_property(GObject *object,
     }
 }
 
-int common_channel_config_socket(RedChannelClient *rcc)
+int common_channel_client_config_socket(RedChannelClient *rcc)
 {
     RedClient *client = red_channel_client_get_client(rcc);
     MainChannelClient *mcc = red_client_get_main(client);
@@ -155,15 +155,12 @@ static void
 common_graphics_channel_class_init(CommonGraphicsChannelClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
-    RedChannelClass *channel_class = RED_CHANNEL_CLASS(klass);
 
     g_type_class_add_private(klass, sizeof(CommonGraphicsChannelPrivate));
 
     object_class->get_property = common_graphics_channel_get_property;
     object_class->set_property = common_graphics_channel_set_property;
 
-    channel_class->config_socket = common_channel_config_socket;
-
     g_object_class_install_property(object_class,
                                     PROP_QXL,
                                     g_param_spec_pointer("qxl",
@@ -208,6 +205,7 @@ common_graphics_channel_client_class_init(CommonGraphicsChannelClientClass *klas
 
     g_type_class_add_private(klass, sizeof(CommonGraphicsChannelClientPrivate));
 
+    client_class->config_socket = common_channel_client_config_socket;
     client_class->alloc_recv_buf = common_alloc_recv_buf;
     client_class->release_recv_buf = common_release_recv_buf;
 }
diff --git a/server/common-graphics-channel.h b/server/common-graphics-channel.h
index bdcb2c8..ae6aac2 100644
--- a/server/common-graphics-channel.h
+++ b/server/common-graphics-channel.h
@@ -25,7 +25,7 @@
 
 G_BEGIN_DECLS
 
-int common_channel_config_socket(RedChannelClient *rcc);
+int common_channel_client_config_socket(RedChannelClient *rcc);
 
 #define COMMON_CLIENT_TIMEOUT (NSEC_PER_SEC * 30)
 
diff --git a/server/dcc.c b/server/dcc.c
index 6413126..ee8709c 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -41,6 +41,7 @@ enum
 };
 
 static void on_display_video_codecs_update(GObject *gobject, GParamSpec *pspec, gpointer user_data);
+static int dcc_config_socket(RedChannelClient *rcc);
 
 static void
 display_channel_client_get_property(GObject *object,
@@ -124,12 +125,15 @@ static void
 display_channel_client_class_init(DisplayChannelClientClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
+    RedChannelClientClass *client_class = RED_CHANNEL_CLIENT_CLASS(klass);
 
     object_class->get_property = display_channel_client_get_property;
     object_class->set_property = display_channel_client_set_property;
     object_class->constructed = display_channel_client_constructed;
     object_class->finalize = display_channel_client_finalize;
 
+    client_class->config_socket = dcc_config_socket;
+
     g_object_class_install_property(object_class,
                                     PROP_IMAGE_COMPRESSION,
                                     g_param_spec_enum("image-compression",
@@ -1417,14 +1421,14 @@ void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate)
     dcc->priv->streams_max_bit_rate = rate;
 }
 
-int dcc_config_socket(RedChannelClient *rcc)
+static int dcc_config_socket(RedChannelClient *rcc)
 {
     RedClient *client = red_channel_client_get_client(rcc);
     MainChannelClient *mcc = red_client_get_main(client);
 
     DISPLAY_CHANNEL_CLIENT(rcc)->is_low_bandwidth = main_channel_client_is_low_bandwidth(mcc);
 
-    return common_channel_config_socket(rcc);
+    return common_channel_client_config_socket(rcc);
 }
 
 gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc)
diff --git a/server/dcc.h b/server/dcc.h
index 31e25b5..cc4f456 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -197,7 +197,6 @@ uint32_t dcc_get_max_stream_latency(DisplayChannelClient *dcc);
 void dcc_set_max_stream_latency(DisplayChannelClient *dcc, uint32_t latency);
 uint64_t dcc_get_max_stream_bit_rate(DisplayChannelClient *dcc);
 void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate);
-int dcc_config_socket(RedChannelClient *rcc);
 gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc);
 GArray *dcc_get_preferred_video_codecs_for_encoding(DisplayChannelClient *dcc);
 
diff --git a/server/display-channel.c b/server/display-channel.c
index 67a77ef..ed3bc7f 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -2237,7 +2237,6 @@ display_channel_class_init(DisplayChannelClass *klass)
     channel_class->handle_migrate_flush_mark = handle_migrate_flush_mark;
     channel_class->handle_migrate_data = handle_migrate_data;
     channel_class->handle_migrate_data_get_serial = handle_migrate_data_get_serial;
-    channel_class->config_socket = dcc_config_socket;
 
     g_object_class_install_property(object_class,
                                     PROP_N_SURFACES,
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 807a61f..b7e902c 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -158,6 +158,7 @@ static const SpiceDataHeaderOpaque mini_header_wrapper;
 static void red_channel_client_clear_sent_item(RedChannelClient *rcc);
 static void red_channel_client_initable_interface_init(GInitableIface *iface);
 static void red_channel_client_set_message_serial(RedChannelClient *channel, uint64_t);
+static int red_channel_client_config_socket(RedChannelClient *rcc);
 
 /*
  * When an error occurs over a channel, we treat it as a warning
@@ -931,7 +932,7 @@ static gboolean red_channel_client_initable_init(GInitable *initable,
     SpiceCoreInterfaceInternal *core;
     RedChannelClient *self = RED_CHANNEL_CLIENT(initable);
 
-    if (!red_channel_config_socket(self->priv->channel, self)) {
+    if (!red_channel_client_config_socket(self)) {
         g_set_error_literal(&local_error,
                             SPICE_SERVER_ERROR,
                             SPICE_SERVER_ERROR_FAILED,
@@ -1053,6 +1054,17 @@ void red_channel_client_shutdown(RedChannelClient *rcc)
     }
 }
 
+static int red_channel_client_config_socket(RedChannelClient *rcc)
+{
+    RedChannelClientClass *klass = RED_CHANNEL_CLIENT_GET_CLASS(rcc);
+
+    if (!klass->config_socket) {
+        return TRUE;
+    }
+
+    return klass->config_socket(rcc);
+}
+
 static uint8_t *red_channel_client_alloc_msg_buf(RedChannelClient *rcc,
                                                  uint16_t type, uint32_t size)
 {
diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index 397216d..b1b29d7 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -169,6 +169,8 @@ struct RedChannelClientClass
 {
     GObjectClass parent_class;
 
+    /* configure socket connected to the client */
+    int (*config_socket)(RedChannelClient *rcc);
     uint8_t *(*alloc_recv_buf)(RedChannelClient *channel, uint16_t type, uint32_t size);
     void (*release_recv_buf)(RedChannelClient *channel, uint16_t type, uint32_t size, uint8_t *msg);
 };
diff --git a/server/red-channel.c b/server/red-channel.c
index 8ae6ece..1f05ebb 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -709,17 +709,6 @@ SpiceCoreInterfaceInternal* red_channel_get_core_interface(RedChannel *channel)
     return channel->priv->core;
 }
 
-int red_channel_config_socket(RedChannel *self, RedChannelClient *rcc)
-{
-    RedChannelClass *klass = RED_CHANNEL_GET_CLASS(self);
-
-    if (!klass->config_socket) {
-        return TRUE;
-    }
-
-    return klass->config_socket(rcc);
-}
-
 void red_channel_on_disconnect(RedChannel *self, RedChannelClient *rcc)
 {
     RedChannelClass *klass = RED_CHANNEL_GET_CLASS(self);
diff --git a/server/red-channel.h b/server/red-channel.h
index 44282f6..ed09905 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -115,7 +115,6 @@ struct RedChannelClass
      * callbacks that are triggered from channel client stream events.
      * They are called from the thread that listen to the stream events.
      */
-    channel_configure_socket_proc config_socket;
     channel_disconnect_proc on_disconnect;
     channel_send_pipe_item_proc send_item;
     channel_handle_migrate_flush_mark_proc handle_migrate_flush_mark;
@@ -224,7 +223,6 @@ struct RedsState* red_channel_get_server(RedChannel *channel);
 SpiceCoreInterfaceInternal* red_channel_get_core_interface(RedChannel *channel);
 
 /* channel callback function */
-int red_channel_config_socket(RedChannel *self, RedChannelClient *rcc);
 void red_channel_on_disconnect(RedChannel *self, RedChannelClient *rcc);
 void red_channel_send_item(RedChannel *self, RedChannelClient *rcc, RedPipeItem *item);
 void red_channel_reset_thread_id(RedChannel *self);
diff --git a/server/sound.c b/server/sound.c
index 118f439..b745cdb 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -732,7 +732,7 @@ static void record_channel_send_item(RedChannelClient *rcc, G_GNUC_UNUSED RedPip
     snd_send(client);
 }
 
-static int snd_channel_config_socket(RedChannelClient *rcc)
+static int snd_channel_client_config_socket(RedChannelClient *rcc)
 {
     int delay_val;
 #ifdef SO_PRIORITY
@@ -1332,7 +1332,6 @@ snd_channel_class_init(SndChannelClass *klass)
 
     object_class->finalize = snd_channel_finalize;
 
-    channel_class->config_socket = snd_channel_config_socket;
     channel_class->on_disconnect = snd_channel_on_disconnect;
 }
 
@@ -1486,6 +1485,7 @@ snd_channel_client_class_init(SndChannelClientClass *klass)
 {
     RedChannelClientClass *client_class = RED_CHANNEL_CLIENT_CLASS(klass);
 
+    client_class->config_socket = snd_channel_client_config_socket;
     client_class->alloc_recv_buf = snd_channel_client_alloc_recv_buf;
     client_class->release_recv_buf = snd_channel_client_release_recv_buf;
 }


More information about the Spice-commits mailing list