[Spice-devel] [PATCH spice-server v8 11/12] fixup! Convert RedChannel hierarchy to GObject

Jonathon Jongsma jjongsma at redhat.com
Mon Oct 24 19:51:23 UTC 2016


On Mon, 2016-10-24 at 09:40 +0100, Frediano Ziglio wrote:
> Move virtual method check back to initialisation.
> Moving to method itself and just giving warning and
> returning cause different regression from design prospective
> and security.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/red-channel.c | 19 ++++++-------------
>  server/red-channel.h |  2 --
>  2 files changed, 6 insertions(+), 15 deletions(-)
> 
> diff --git a/server/red-channel.c b/server/red-channel.c
> index bff7841..36ce44f 100644
> --- a/server/red-channel.c
> +++ b/server/red-channel.c
> @@ -225,6 +225,12 @@ red_channel_constructed(GObject *object)
>                  self->priv->type, self->priv->id, self->priv-
> >thread_id);
>  
>      RedChannelClass *klass = RED_CHANNEL_GET_CLASS(self);
> +
> +    spice_assert(klass->config_socket && 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));
> +
>      self->priv->incoming_cb.alloc_msg_buf =
>          (alloc_msg_recv_buf_proc)klass->alloc_recv_buf;
>      self->priv->incoming_cb.release_msg_buf =
> @@ -993,7 +999,6 @@ SpiceCoreInterfaceInternal*
> red_channel_get_core_interface(RedChannel *channel)
>  int red_channel_config_socket(RedChannel *self, RedChannelClient
> *rcc)
>  {
>      RedChannelClass *klass = RED_CHANNEL_GET_CLASS(self);
> -    g_return_val_if_fail(klass->config_socket, FALSE);
>  
>      return klass->config_socket(rcc);
>  }
> @@ -1001,7 +1006,6 @@ int red_channel_config_socket(RedChannel *self,
> RedChannelClient *rcc)
>  void red_channel_on_disconnect(RedChannel *self, RedChannelClient
> *rcc)
>  {
>      RedChannelClass *klass = RED_CHANNEL_GET_CLASS(self);
> -    g_return_if_fail(klass->on_disconnect);
>  
>      klass->on_disconnect(rcc);
>  }
> @@ -1018,7 +1022,6 @@ uint8_t* red_channel_alloc_recv_buf(RedChannel
> *self, RedChannelClient *rcc,
>                                      uint16_t type, uint32_t size)
>  {
>      RedChannelClass *klass = RED_CHANNEL_GET_CLASS(self);
> -    g_return_val_if_fail(klass->alloc_recv_buf, NULL);
>  
>      return klass->alloc_recv_buf(rcc, type, size);
>  }
> @@ -1027,7 +1030,6 @@ void red_channel_release_recv_buf(RedChannel
> *self, RedChannelClient *rcc,
>                                    uint16_t type, uint32_t size,
> uint8_t *msg)
>  {
>      RedChannelClass *klass = RED_CHANNEL_GET_CLASS(self);
> -    g_return_if_fail(klass->release_recv_buf);
>  
>      klass->release_recv_buf(rcc, type, size, msg);
>  }
> @@ -1040,15 +1042,6 @@ int
> red_channel_handle_migrate_flush_mark(RedChannel *self,
> RedChannelClient *rc
>      return klass->handle_migrate_flush_mark(rcc);
>  }
>  
> -int red_channel_handle_migrate_data(RedChannel *self,
> RedChannelClient *rcc,
> -                                    uint32_t size, void *message)
> -{
> -    RedChannelClass *klass = RED_CHANNEL_GET_CLASS(self);
> -    g_return_val_if_fail(klass->handle_migrate_data, FALSE);
> -
> -    return klass->handle_migrate_data(rcc, size, message);
> -}
> -


This hunk looks unrelated. Included by accident?


>  IncomingHandlerInterface*
> red_channel_get_incoming_handler(RedChannel *self)
>  {
>      return &self->priv->incoming_cb;
> diff --git a/server/red-channel.h b/server/red-channel.h
> index 0bba15b..f99a03f 100644
> --- a/server/red-channel.h
> +++ b/server/red-channel.h
> @@ -321,8 +321,6 @@ uint8_t* red_channel_alloc_recv_buf(RedChannel
> *self, RedChannelClient *rcc,
>  void red_channel_release_recv_buf(RedChannel *self, RedChannelClient
> *rcc,
>                                    uint16_t type, uint32_t size,
> uint8_t *msg);
>  int red_channel_handle_migrate_flush_mark(RedChannel *self,
> RedChannelClient *rcc);
> -int red_channel_handle_migrate_data(RedChannel *self,
> RedChannelClient *rcc,
> -                                    uint32_t size, void *message);
>  void red_channel_reset_thread_id(RedChannel *self);
>  StatNodeRef red_channel_get_stat_node(RedChannel *channel);
>  

same


More information about the Spice-devel mailing list