Re: [PATCH spice-server v2 3/3] Remove core parameter from main_dispatcher_new

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

 



Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>


On Tue, 2019-02-12 at 21:24 +0000, Frediano Ziglio wrote:
> This was added in bd8771adbcf3ff34d14333cf874191e8d105f612.
> There's no reason to not use reds function instead.
> MainDispatcher needs to listen in the main thread that is the
> one provided by reds_core_* functions.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  server/main-dispatcher.c | 29 ++++++-----------------------
>  server/main-dispatcher.h |  2 +-
>  server/reds.c            |  2 +-
>  3 files changed, 8 insertions(+), 25 deletions(-)
> 
> diff --git a/server/main-dispatcher.c b/server/main-dispatcher.c
> index 99d2a6216..82b25e6e4 100644
> --- a/server/main-dispatcher.c
> +++ b/server/main-dispatcher.c
> @@ -48,7 +48,6 @@
>   */
>  struct MainDispatcherPrivate
>  {
> -    SpiceCoreInterfaceInternal *core; /* weak */
>      RedsState *reds; /* weak */
>      SpiceWatch *watch;
>  };
> @@ -58,7 +57,6 @@ G_DEFINE_TYPE_WITH_PRIVATE(MainDispatcher,
> main_dispatcher, TYPE_DISPATCHER)
>  enum {
>      PROP0,
>      PROP_SPICE_SERVER,
> -    PROP_CORE_INTERFACE
>  };
>  
>  static void
> @@ -73,9 +71,6 @@ main_dispatcher_get_property(GObject    *object,
>          case PROP_SPICE_SERVER:
>               g_value_set_pointer(value, self->priv->reds);
>              break;
> -        case PROP_CORE_INTERFACE:
> -             g_value_set_pointer(value, self->priv->core);
> -            break;
>          default:
>              G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id,
> pspec);
>      }
> @@ -93,9 +88,6 @@ main_dispatcher_set_property(GObject      *object,
>          case PROP_SPICE_SERVER:
>              self->priv->reds = g_value_get_pointer(value);
>              break;
> -        case PROP_CORE_INTERFACE:
> -            self->priv->core = g_value_get_pointer(value);
> -            break;
>          default:
>              G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id,
> pspec);
>      }
> @@ -121,14 +113,6 @@ main_dispatcher_class_init(MainDispatcherClass
> *klass)
>                                                           "The spice
> server associated with this dispatcher",
>                                                           G_PARAM_REA
> DWRITE |
>                                                           G_PARAM_CON
> STRUCT_ONLY));
> -
> -    g_object_class_install_property(object_class,
> -                                    PROP_CORE_INTERFACE,
> -                                    g_param_spec_pointer("core-
> interface",
> -                                                         "core-
> interface",
> -                                                         "The
> SpiceCoreInterface server associated with this dispatcher",
> -                                                         G_PARAM_REA
> DWRITE |
> -                                                         G_PARAM_CON
> STRUCT_ONLY));
>  }
>  
>  static void
> @@ -284,11 +268,10 @@ static void dispatcher_handle_read(int fd, int
> event, void *opaque)
>   * Reds routines shouldn't be exposed. Instead reds.c should
> register the callbacks,
>   * and the corresponding operations should be made only via
> main_dispatcher.
>   */
> -MainDispatcher* main_dispatcher_new(RedsState *reds,
> SpiceCoreInterfaceInternal *core)
> +MainDispatcher* main_dispatcher_new(RedsState *reds)
>  {
>      MainDispatcher *self = g_object_new(TYPE_MAIN_DISPATCHER,
>                                          "spice-server", reds,
> -                                        "core-interface", core,
>                                          "max-message-type",
> MAIN_DISPATCHER_NUM_MESSAGES,
>                                          NULL);
>      return self;
> @@ -302,10 +285,10 @@ void main_dispatcher_constructed(GObject
> *object)
>      dispatcher_set_opaque(DISPATCHER(self), self);
>  
>      self->priv->watch =
> -        self->priv->core->watch_add(self->priv->core,
> -                                    dispatcher_get_recv_fd(DISPATCHE
> R(self)),
> -                                    SPICE_WATCH_EVENT_READ,
> dispatcher_handle_read,
> -                                    DISPATCHER(self));
> +        reds_core_watch_add(self->priv->reds,
> +                            dispatcher_get_recv_fd(DISPATCHER(self))
> ,
> +                            SPICE_WATCH_EVENT_READ,
> dispatcher_handle_read,
> +                            DISPATCHER(self));
>      dispatcher_register_handler(DISPATCHER(self),
> MAIN_DISPATCHER_CHANNEL_EVENT,
>                                  main_dispatcher_handle_channel_event
> ,
>                                  sizeof(MainDispatcherChannelEventMes
> sage), false);
> @@ -324,7 +307,7 @@ static void main_dispatcher_finalize(GObject
> *object)
>  {
>      MainDispatcher *self = MAIN_DISPATCHER(object);
>  
> -    self->priv->core->watch_remove(self->priv->core, self->priv-
> >watch);
> +    reds_core_watch_remove(self->priv->reds, self->priv->watch);
>      self->priv->watch = NULL;
>      G_OBJECT_CLASS(main_dispatcher_parent_class)->finalize(object);
>  }
> diff --git a/server/main-dispatcher.h b/server/main-dispatcher.h
> index 088a5c216..e1244f836 100644
> --- a/server/main-dispatcher.h
> +++ b/server/main-dispatcher.h
> @@ -59,6 +59,6 @@ void
> main_dispatcher_set_mm_time_latency(MainDispatcher *self, RedClient
> *client
>   */
>  void main_dispatcher_client_disconnect(MainDispatcher *self,
> RedClient *client);
>  
> -MainDispatcher* main_dispatcher_new(RedsState *reds,
> SpiceCoreInterfaceInternal *core);
> +MainDispatcher* main_dispatcher_new(RedsState *reds);
>  
>  #endif /* MAIN_DISPATCHER_H_ */
> diff --git a/server/reds.c b/server/reds.c
> index b73253947..306bb7c6e 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -3504,7 +3504,7 @@ static int do_spice_init(RedsState *reds,
> SpiceCoreInterface *core_interface)
>      reds->agent_dev = red_char_device_vdi_port_new(reds);
>      reds_update_agent_properties(reds);
>      reds->clients = NULL;
> -    reds->main_dispatcher = main_dispatcher_new(reds, &reds->core);
> +    reds->main_dispatcher = main_dispatcher_new(reds);
>      reds->channels = NULL;
>      reds->mig_target_clients = NULL;
>      reds->char_devices = NULL;

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




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