[Spice-devel] [PATCH spice-server 2/3] red-channel-client: Remove unused vfuncs

Frediano Ziglio fziglio at redhat.com
Wed Feb 15 16:44:53 UTC 2017


> 
> On Wed, Feb 15, 2017 at 12:49:06PM +0000, Frediano Ziglio wrote:
> > RedChannelClient is responsible for talking to the client so it knows
> > how if is connected or not.
> 
> s/how//
> 
> I'd mention explicitly that it's RedChannelClient::is_connected and
> RedChannelClient::disconnect which are dropped (would even belong in the
> shortlog if it's not too long).
> 

What about

"red-channel-client: Remove unused RedChannelClient::{is_connected,disconnect}"

> > About disconnect you think that we loose a bit of flexibility however on
> > disconnect the channel is triggered so additional needed process can be
> > handled in destructor.
> 
> I'd drop that paragraph, as we don't have any classes overriding the
> vfunc anyway, and client disconnection and the last ref being dropped
> may occur at different times.
> 
> 
> > These vfuncs where used by DummyChannel used by SoundChannel.
> 
> 
> Acked-by: Christophe Fergeau <cfergeau at redhat.com>
> 
> > 
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> >  server/red-channel-client.c | 27 ++-------------------------
> >  server/red-channel-client.h |  3 ---
> >  2 files changed, 2 insertions(+), 28 deletions(-)
> > 
> > diff --git a/server/red-channel-client.c b/server/red-channel-client.c
> > index 32db186..16e5446 100644
> > --- a/server/red-channel-client.c
> > +++ b/server/red-channel-client.c
> > @@ -364,10 +364,6 @@ static void
> > red_channel_client_initable_interface_init(GInitableIface *iface)
> >      iface->init = red_channel_client_initable_init;
> >  }
> >  
> > -static gboolean red_channel_client_default_is_connected(RedChannelClient
> > *rcc);
> > -static void red_channel_client_default_disconnect(RedChannelClient *rcc);
> > -
> > -
> >  static void red_channel_client_constructed(GObject *object)
> >  {
> >      RedChannelClient *self =  RED_CHANNEL_CLIENT(object);
> > @@ -400,9 +396,6 @@ static void
> > red_channel_client_class_init(RedChannelClientClass *klass)
> >      object_class->finalize = red_channel_client_finalize;
> >      object_class->constructed = red_channel_client_constructed;
> >  
> > -    klass->is_connected = red_channel_client_default_is_connected;
> > -    klass->disconnect = red_channel_client_default_disconnect;
> > -
> >      spec = g_param_spec_pointer("stream", "stream",
> >                                  "Associated RedStream",
> >                                  G_PARAM_STATIC_STRINGS
> > @@ -1701,20 +1694,12 @@ gboolean
> > red_channel_client_is_mini_header(RedChannelClient *rcc)
> >      return rcc->priv->is_mini_header;
> >  }
> >  
> > -static gboolean red_channel_client_default_is_connected(RedChannelClient
> > *rcc)
> > +gboolean red_channel_client_is_connected(RedChannelClient *rcc)
> >  {
> >      return rcc->priv->channel
> >          && (g_list_find(red_channel_get_clients(rcc->priv->channel), rcc)
> >          != NULL);
> >  }
> >  
> > -gboolean red_channel_client_is_connected(RedChannelClient *rcc)
> > -{
> > -    RedChannelClientClass *klass = RED_CHANNEL_CLIENT_GET_CLASS(rcc);
> > -
> > -    g_return_val_if_fail(klass->is_connected != NULL, FALSE);
> > -    return klass->is_connected(rcc);
> > -}
> > -
> >  static void red_channel_client_clear_sent_item(RedChannelClient *rcc)
> >  {
> >      rcc->priv->send_data.blocked = FALSE;
> > @@ -1752,7 +1737,7 @@ void red_channel_client_push_set_ack(RedChannelClient
> > *rcc)
> >      red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_SET_ACK);
> >  }
> >  
> > -static void red_channel_client_default_disconnect(RedChannelClient *rcc)
> > +void red_channel_client_disconnect(RedChannelClient *rcc)
> >  {
> >      RedChannel *channel = rcc->priv->channel;
> >      SpiceCoreInterfaceInternal *core =
> >      red_channel_get_core_interface(channel);
> > @@ -1781,14 +1766,6 @@ static void
> > red_channel_client_default_disconnect(RedChannelClient *rcc)
> >      red_channel_on_disconnect(channel, rcc);
> >  }
> >  
> > -void red_channel_client_disconnect(RedChannelClient *rcc)
> > -{
> > -    RedChannelClientClass *klass = RED_CHANNEL_CLIENT_GET_CLASS(rcc);
> > -
> > -    g_return_if_fail(klass->is_connected != NULL);
> > -    klass->disconnect(rcc);
> > -}
> > -
> >  int red_channel_client_is_blocked(RedChannelClient *rcc)
> >  {
> >      return rcc && rcc->priv->send_data.blocked;
> > diff --git a/server/red-channel-client.h b/server/red-channel-client.h
> > index 75d6cc3..1b0b810 100644
> > --- a/server/red-channel-client.h
> > +++ b/server/red-channel-client.h
> > @@ -192,9 +192,6 @@ struct RedChannelClient
> >  struct RedChannelClientClass
> >  {
> >      GObjectClass parent_class;
> > -
> > -    gboolean (*is_connected)(RedChannelClient *rcc);
> > -    void (*disconnect)(RedChannelClient *rcc);
> >  };
> >  
> >  #define SPICE_SERVER_ERROR spice_server_error_quark()



More information about the Spice-devel mailing list