[Spice-devel] [PATCH v9 03/11] Make RedChannelClient::incoming private
Jonathon Jongsma
jjongsma at redhat.com
Thu Dec 22 16:58:52 UTC 2016
I'd like additional comments in the commit log explaining why we can do
this (because we refactored the sound stuff to use the RedChannelClient
infrastructure, etc)
The code looks fine though
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
On Tue, 2016-12-20 at 17:44 +0000, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/red-channel-client-private.h | 11 +++++++++++
> server/red-channel-client.c | 12 ++++++------
> server/red-channel-client.h | 13 -------------
> 3 files changed, 17 insertions(+), 19 deletions(-)
>
> diff --git a/server/red-channel-client-private.h b/server/red-
> channel-client-private.h
> index 593fee5..d01cdbd 100644
> --- a/server/red-channel-client-private.h
> +++ b/server/red-channel-client-private.h
> @@ -50,6 +50,16 @@ typedef struct OutgoingHandler {
> int size;
> } OutgoingHandler;
>
> +typedef struct IncomingHandler {
> + IncomingHandlerInterface *cb;
> + void *opaque;
> + uint8_t header_buf[MAX_HEADER_SIZE];
> + SpiceDataHeaderOpaque header;
> + uint32_t header_pos;
> + uint8_t *msg; // data of the msg following the header. allocated
> by alloc_msg_buf.
> + uint32_t msg_pos;
> +} IncomingHandler;
> +
> struct RedChannelClientPrivate
> {
> RedChannel *channel;
> @@ -95,6 +105,7 @@ struct RedChannelClientPrivate
> RedChannelClientLatencyMonitor latency_monitor;
> RedChannelClientConnectivityMonitor connectivity_monitor;
>
> + IncomingHandler incoming;
> OutgoingHandler outgoing;
> };
>
> diff --git a/server/red-channel-client.c b/server/red-channel-
> client.c
> index 8312d3e..0002951 100644
> --- a/server/red-channel-client.c
> +++ b/server/red-channel-client.c
> @@ -268,8 +268,8 @@ static void
> red_channel_client_constructed(GObject *object)
> {
> RedChannelClient *self = RED_CHANNEL_CLIENT(object);
>
> - self->incoming.opaque = self;
> - self->incoming.cb = red_channel_get_incoming_handler(self->priv-
> >channel);
> + self->priv->incoming.opaque = self;
> + self->priv->incoming.cb = red_channel_get_incoming_handler(self-
> >priv->channel);
>
> self->priv->outgoing.opaque = self;
> self->priv->outgoing.cb = red_channel_get_outgoing_handler(self-
> >priv->channel);
> @@ -277,15 +277,15 @@ static void
> red_channel_client_constructed(GObject *object)
> self->priv->outgoing.size = 0;
>
> if (red_channel_client_test_remote_common_cap(self,
> SPICE_COMMON_CAP_MINI_HEADER)) {
> - self->incoming.header = mini_header_wrapper;
> + self->priv->incoming.header = mini_header_wrapper;
> self->priv->send_data.header = mini_header_wrapper;
> self->priv->is_mini_header = TRUE;
> } else {
> - self->incoming.header = full_header_wrapper;
> + self->priv->incoming.header = full_header_wrapper;
> self->priv->send_data.header = full_header_wrapper;
> self->priv->is_mini_header = FALSE;
> }
> - self->incoming.header.data = self->incoming.header_buf;
> + self->priv->incoming.header.data = self->priv-
> >incoming.header_buf;
> }
>
> static void red_channel_client_class_init(RedChannelClientClass
> *klass)
> @@ -1178,7 +1178,7 @@ static void red_peer_handle_incoming(RedsStream
> *stream, IncomingHandler *handle
> void red_channel_client_receive(RedChannelClient *rcc)
> {
> g_object_ref(rcc);
> - red_peer_handle_incoming(rcc->priv->stream, &rcc->incoming);
> + red_peer_handle_incoming(rcc->priv->stream, &rcc->priv-
> >incoming);
> g_object_unref(rcc);
> }
>
> diff --git a/server/red-channel-client.h b/server/red-channel-
> client.h
> index 0d404d1..fada609 100644
> --- a/server/red-channel-client.h
> +++ b/server/red-channel-client.h
> @@ -190,23 +190,10 @@ 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 IncomingHandler {
> - IncomingHandlerInterface *cb;
> - void *opaque;
> - uint8_t header_buf[MAX_HEADER_SIZE];
> - SpiceDataHeaderOpaque header;
> - uint32_t header_pos;
> - uint8_t *msg; // data of the msg following the header. allocated
> by alloc_msg_buf.
> - uint32_t msg_pos;
> -} IncomingHandler;
> -
> struct RedChannelClient
> {
> GObject parent;
>
> - /* protected */
> - IncomingHandler incoming;
> -
> RedChannelClientPrivate *priv;
> };
>
More information about the Spice-devel
mailing list