[Spice-devel] [PATCH spice-server 4/4] Provide and reuse default implementation for config_socket

Frediano Ziglio fziglio at redhat.com
Mon Feb 13 11:03:19 UTC 2017


Most channel don't need to do specific settings for the
client socket so provide a default implementation to
make easier to setup the client channnel.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/inputs-channel.c     | 6 ------
 server/main-channel.c       | 6 ------
 server/red-channel-client.c | 5 +++++
 server/red-channel-client.h | 2 ++
 server/red-channel.c        | 2 ++
 server/smartcard.c          | 6 ------
 server/spicevmc.c           | 6 ------
 7 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 897e8e7..6a6dce8 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -488,11 +488,6 @@ static void inputs_pipe_add_init(RedChannelClient *rcc)
     red_channel_client_pipe_add_push(rcc, &item->base);
 }
 
-static int inputs_channel_config_socket(RedChannelClient *rcc)
-{
-    return TRUE;
-}
-
 static void inputs_connect(RedChannel *channel, RedClient *client,
                            RedsStream *stream, int migration,
                            int num_common_caps, uint32_t *common_caps,
@@ -638,7 +633,6 @@ inputs_channel_class_init(InputsChannelClass *klass)
     channel_class->handle_parsed = inputs_channel_handle_parsed;
 
     /* channel callbacks */
-    channel_class->config_socket = inputs_channel_config_socket;
     channel_class->on_disconnect = inputs_channel_on_disconnect;
     channel_class->send_item = inputs_channel_send_item;
     channel_class->alloc_recv_buf = inputs_channel_alloc_msg_rcv_buf;
diff --git a/server/main-channel.c b/server/main-channel.c
index 1124506..4f39b91 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -277,11 +277,6 @@ static void main_channel_release_msg_rcv_buf(RedChannelClient *rcc,
     }
 }
 
-static int main_channel_config_socket(RedChannelClient *rcc)
-{
-    return TRUE;
-}
-
 static int main_channel_handle_migrate_flush_mark(RedChannelClient *rcc)
 {
     RedChannel *channel = red_channel_client_get_channel(rcc);
@@ -355,7 +350,6 @@ main_channel_class_init(MainChannelClass *klass)
     channel_class->handle_parsed = main_channel_handle_parsed;
 
     /* channel callbacks */
-    channel_class->config_socket = main_channel_config_socket;
     channel_class->on_disconnect = main_channel_client_on_disconnect;
     channel_class->send_item = main_channel_client_send_item;
     channel_class->alloc_recv_buf = main_channel_alloc_msg_rcv_buf;
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 2450923..f55ba85 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -1820,6 +1820,11 @@ gboolean red_channel_client_set_migration_seamless(RedChannelClient *rcc)
     return ret;
 }
 
+int red_channel_client_config_socket(RedChannelClient *rcc)
+{
+    return TRUE;
+}
+
 void red_channel_client_set_destroying(RedChannelClient *rcc)
 {
     rcc->priv->destroying = TRUE;
diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index fada609..a5dc709 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -190,6 +190,8 @@ gboolean red_channel_client_set_migration_seamless(RedChannelClient *rcc);
 void red_channel_client_set_destroying(RedChannelClient *rcc);
 gboolean red_channel_client_is_destroying(RedChannelClient *rcc);
 
+int red_channel_client_config_socket(RedChannelClient *rcc);
+
 struct RedChannelClient
 {
     GObject parent;
diff --git a/server/red-channel.c b/server/red-channel.c
index f2a35f3..fb34406 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -268,6 +268,8 @@ red_channel_class_init(RedChannelClass *klass)
     object_class->finalize = red_channel_finalize;
     object_class->constructed = red_channel_constructed;
 
+    klass->config_socket = red_channel_client_config_socket;
+
     spec = g_param_spec_pointer("spice-server",
                                 "spice-server",
                                 "The spice server associated with this channel",
diff --git a/server/smartcard.c b/server/smartcard.c
index f4bc40d..e243a92 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -392,11 +392,6 @@ void smartcard_char_device_detach_client(RedCharDeviceSmartcard *smartcard,
     smartcard->priv->scc = NULL;
 }
 
-static int smartcard_channel_client_config_socket(RedChannelClient *rcc)
-{
-    return TRUE;
-}
-
 SmartCardChannelClient* smartcard_char_device_get_client(RedCharDeviceSmartcard *smartcard)
 {
     return smartcard->priv->scc;
@@ -592,7 +587,6 @@ red_smartcard_channel_class_init(RedSmartcardChannelClass *klass)
 
     channel_class->handle_message = smartcard_channel_client_handle_message,
 
-    channel_class->config_socket = smartcard_channel_client_config_socket;
     channel_class->on_disconnect = smartcard_channel_client_on_disconnect;
     channel_class->send_item = smartcard_channel_send_item;
     channel_class->alloc_recv_buf = smartcard_channel_client_alloc_msg_rcv_buf;
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 1003a2f..c675174 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -425,11 +425,6 @@ static void spicevmc_char_dev_remove_client(RedCharDevice *self,
     red_channel_client_shutdown(channel->rcc);
 }
 
-static int spicevmc_red_channel_client_config_socket(RedChannelClient *rcc)
-{
-    return TRUE;
-}
-
 static void spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc)
 {
     RedVmcChannel *channel;
@@ -718,7 +713,6 @@ red_vmc_channel_class_init(RedVmcChannelClass *klass)
 
     channel_class->handle_parsed = spicevmc_red_channel_client_handle_message_parsed;
 
-    channel_class->config_socket = spicevmc_red_channel_client_config_socket;
     channel_class->on_disconnect = spicevmc_red_channel_client_on_disconnect;
     channel_class->send_item = spicevmc_red_channel_send_item;
     channel_class->alloc_recv_buf = spicevmc_red_channel_alloc_msg_rcv_buf;
-- 
2.9.3



More information about the Spice-devel mailing list