[PATCH spice-server 4/4] Make RedChannel::config_socket() optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Most channels don't need to do specific settings for the client socket
so avoid the need to do this setting making easier to setup the client
channnel.

Some improvements and commit subject suggested by Christophe Fergeau.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/inputs-channel.c | 6 ------
 server/main-channel.c   | 6 ------
 server/red-channel.c    | 6 +++++-
 server/smartcard.c      | 6 ------
 server/spicevmc.c       | 6 ------
 5 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 223f46f..ed92e71 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -484,11 +484,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,
@@ -634,7 +629,6 @@ inputs_channel_class_init(InputsChannelClass *klass)
     channel_class->handle_message = inputs_channel_handle_message;
 
     /* 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 2d32444..3a6e6cd 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_message = main_channel_handle_message;
 
     /* 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.c b/server/red-channel.c
index 2f9173b..67a570d 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -210,7 +210,7 @@ red_channel_constructed(GObject *object)
 
     G_OBJECT_CLASS(red_channel_parent_class)->constructed(object);
 
-    spice_assert(klass->config_socket && klass->on_disconnect &&
+    spice_assert(klass->on_disconnect &&
                  klass->alloc_recv_buf && klass->release_recv_buf);
     spice_assert(klass->handle_migrate_data ||
                  !(self->priv->migration_flags & SPICE_MIGRATE_NEED_DATA_TRANSFER));
@@ -732,6 +732,10 @@ 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);
 }
 
diff --git a/server/smartcard.c b/server/smartcard.c
index a7cc614..8f12fd9 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -394,11 +394,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;
@@ -585,7 +580,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 4b46e54..e705bc7 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -440,11 +440,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;
@@ -736,7 +731,6 @@ red_vmc_channel_class_init(RedVmcChannelClass *klass)
 
     channel_class->handle_message = spicevmc_red_channel_client_handle_message;
 
-    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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]