[Spice-devel] [PATCH spice] rcc: Make OutgoingHandler private

Frediano Ziglio fziglio at redhat.com
Fri Oct 14 14:07:42 UTC 2016


> 
> ---
>  server/red-channel-client-private.h | 12 ++++++++++++
>  server/red-channel-client.c         | 10 +++++-----
>  server/red-channel-client.h         | 11 -----------
>  3 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/server/red-channel-client-private.h
> b/server/red-channel-client-private.h
> index f94e042..83fef23 100644
> --- a/server/red-channel-client-private.h
> +++ b/server/red-channel-client-private.h
> @@ -21,6 +21,16 @@
>  #include "red-channel.h"
>  #include "red-channel-client.h"
>  
> +typedef struct OutgoingHandler {
> +    OutgoingHandlerInterface *cb;
> +    void *opaque;
> +    struct iovec vec_buf[IOV_MAX];
> +    int vec_size;
> +    struct iovec *vec;
> +    int pos;
> +    int size;
> +} OutgoingHandler;
> +
>  struct RedChannelClientPrivate
>  {
>      RedChannel *channel;
> @@ -70,6 +80,8 @@ struct RedChannelClientPrivate
>  
>      RedChannelClientLatencyMonitor latency_monitor;
>      RedChannelClientConnectivityMonitor connectivity_monitor;
> +
> +    OutgoingHandler outgoing;
>  };
>  
>  #endif /* _H_RED_CHANNEL_CLIENT_PRIVATE */
> diff --git a/server/red-channel-client.c b/server/red-channel-client.c
> index e860390..36d9c33 100644
> --- a/server/red-channel-client.c
> +++ b/server/red-channel-client.c
> @@ -874,10 +874,10 @@ static gboolean
> red_channel_client_initable_init(GInitable *initable,
>      self->incoming.cb = &self->priv->channel->incoming_cb;
>      self->incoming.header.data = self->incoming.header_buf;
>  
> -    self->outgoing.opaque = self;
> -    self->outgoing.cb = &self->priv->channel->outgoing_cb;
> -    self->outgoing.pos = 0;
> -    self->outgoing.size = 0;
> +    self->priv->outgoing.opaque = self;
> +    self->priv->outgoing.cb = &self->priv->channel->outgoing_cb;
> +    self->priv->outgoing.pos = 0;
> +    self->priv->outgoing.size = 0;
>  
>      g_queue_init(&self->priv->pipe);
>      if (self->priv->stream)
> @@ -1189,7 +1189,7 @@ void red_channel_client_receive(RedChannelClient *rcc)
>  void red_channel_client_send(RedChannelClient *rcc)
>  {
>      g_object_ref(rcc);
> -    red_peer_handle_outgoing(rcc->priv->stream, &rcc->outgoing);
> +    red_peer_handle_outgoing(rcc->priv->stream, &rcc->priv->outgoing);
>      g_object_unref(rcc);
>  }
>  
> diff --git a/server/red-channel-client.h b/server/red-channel-client.h
> index 0b180b3..4645d25 100644
> --- a/server/red-channel-client.h
> +++ b/server/red-channel-client.h
> @@ -192,16 +192,6 @@ 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);
>  
> -typedef struct OutgoingHandler {
> -    OutgoingHandlerInterface *cb;
> -    void *opaque;
> -    struct iovec vec_buf[IOV_MAX];
> -    int vec_size;
> -    struct iovec *vec;
> -    int pos;
> -    int size;
> -} OutgoingHandler;
> -
>  typedef struct IncomingHandler {
>      IncomingHandlerInterface *cb;
>      void *opaque;
> @@ -217,7 +207,6 @@ struct RedChannelClient
>      GObject parent;
>  
>      /* protected */
> -    OutgoingHandler outgoing;
>      IncomingHandler incoming;
>  
>      RedChannelClientPrivate *priv;

red-channel-client-private.h is included quite a lot however
outgoing field is used only by RedChannelClient code so it's
fine.

I tried to rebase refactory patches on top of this and it's not
too complicate so

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Frediano


More information about the Spice-devel mailing list